Class: Class
Instance Method Summary collapse
-
#convey_attributes_to_child(child, *attributes) ⇒ Object
Extracted from Rails code base.
- #inherited_by_conveying_attributes(*attributes, &block) ⇒ Object
Instance Method Details
#convey_attributes_to_child(child, *attributes) ⇒ Object
Extracted from Rails code base
5 6 7 |
# File 'lib/omu_support/core_ext/class.rb', line 5 def convey_attributes_to_child(child, *attributes) attributes.each { |attribute| child.__send__ "#{attribute}=", duplicated_attribute(attribute) } end |
#inherited_by_conveying_attributes(*attributes, &block) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/omu_support/core_ext/class.rb', line 9 def (*attributes, &block) define_singleton_method :inherited do |child| convey_attributes_to_child(child, *attributes) super(child) block&.call(child) end end |