Module: ResourceSet::InheritableAttribute
- Included in:
- Resource
- Defined in:
- lib/resource_set/inheritable_attribute.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.inherit(klass, name) ⇒ Object
15 16 17 18 |
# File 'lib/resource_set/inheritable_attribute.rb', line 15 def self.inherit(klass, name) return unless klass.superclass.respond_to?(name) and value = klass.superclass.send(name) value.clone end |
Instance Method Details
#inheritable_attr(name) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/resource_set/inheritable_attribute.rb', line 3 def inheritable_attr(name) instance_eval <<-RUBY def #{name}=(v) @#{name} = v end def #{name} @#{name} ||= InheritableAttribute.inherit(self, :#{name}) end RUBY end |