Method: ClassLevelInheritableAttributes::ClassMethods#inheritable_attributes

Defined in:
lib/medea/inheritable_attributes.rb

#inheritable_attributes(*args) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/medea/inheritable_attributes.rb', line 10

def inheritable_attributes(*args)
  #for some reason, in rails, @inheritable_attributes is set to be an empty hash here...
  #check for this strange case and account for it.
  @inheritable_attributes = [:inheritable_attributes] if @inheritable_attributes == {} ||
                                                         @inheritable_attributes == nil
  @inheritable_attributes += args
  args.each do |arg|
    class_eval %(
      class << self; attr_accessor :#{arg} end
    )
  end
  @inheritable_attributes
end