Module: MJ::Mixins::InheritedAttributes::ClassMethods

Defined in:
lib/mj/mixins/inherited_attributes.rb

Overview

Class methods

Instance Method Summary collapse

Instance Method Details

#inherited_attr_accessor(name) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/mj/mixins/inherited_attributes.rb', line 27

def inherited_attr_accessor( name )
    class_eval <<-EOF

    attr_writer :#{name}

    def #{name}
        return @#{name} if @#{name}
        return parent.#{name} if @parent
        return nil
    end
    EOF
end