3 def self.included(base)
4 base.extend ClassMethods
8 def self.extended(base)
10 alias :inherited_without_annotatable :inherited
11 alias :inherited :inherited_with_annotatable
17 options = attrs.pop if attrs.last.kind_of?(Hash)
18 options.symbolize_keys!
19 inherit = options[:inherit]
21 @inherited_annotations ||= []
22 @inherited_annotations += attrs
26 def self.#{attr}(string = nil)
27 @#{attr} = string || @#{attr}
29 def #{attr}(string = nil)
30 self.class.#{attr}(string)
32 def self.#{attr}=(string = nil)
35 def #{attr}=(string = nil)
36 self.class.#{attr}=(string)
43 def inherited_with_annotatable(subclass)
44 inherited_without_annotatable(subclass)
45 (["inherited_annotations"] + (@inherited_annotations || [])).each do |t|
47 subclass.instance_variable_set(ivar, instance_variable_get(ivar))
54 # We don't necessarily have ActiveSupport loaded yet!
56 # Return a new hash with all keys converted to symbols.
58 inject({}) do |options, (key, value)|
59 options[key.to_sym || key] = value
64 # Destructively convert all keys to symbols.
66 self.replace(self.symbolize_keys)