Module: ClassInheritableAttributes::ClassMethods

Defined in:
lib/action_controller/support/class_inheritable_attributes.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#inheritable_attributesObject



14
15
16
# File 'lib/action_controller/support/class_inheritable_attributes.rb', line 14

def inheritable_attributes
  @@classes[self] ||= {}
end

#read_inheritable_attribute(key) ⇒ Object



27
28
29
# File 'lib/action_controller/support/class_inheritable_attributes.rb', line 27

def read_inheritable_attribute(key)
  inheritable_attributes[key]
end

#reset_inheritable_attributesObject



31
32
33
# File 'lib/action_controller/support/class_inheritable_attributes.rb', line 31

def reset_inheritable_attributes
  inheritable_attributes.clear
end

#write_inheritable_array(key, elements) ⇒ Object



22
23
24
25
# File 'lib/action_controller/support/class_inheritable_attributes.rb', line 22

def write_inheritable_array(key, elements)
  write_inheritable_attribute(key, []) if read_inheritable_attribute(key).nil?
  write_inheritable_attribute(key, read_inheritable_attribute(key) + elements)
end

#write_inheritable_attribute(key, value) ⇒ Object



18
19
20
# File 'lib/action_controller/support/class_inheritable_attributes.rb', line 18

def write_inheritable_attribute(key, value)
  inheritable_attributes[key] = value
end