Module: AttrInit
- Defined in:
- lib/attr_init.rb,
lib/attr_init/version.rb
Constant Summary collapse
- VERSION =
"0.1.4"
Class Method Summary collapse
- .add_new_attrs(scope, attrs) ⇒ Object
- .get_attrs(scope) ⇒ Object
- .hidden_attrs_variable_name ⇒ Object
Class Method Details
.add_new_attrs(scope, attrs) ⇒ Object
68 69 70 71 72 73 74 75 |
# File 'lib/attr_init.rb', line 68 def self.add_new_attrs(scope, attrs) begin hidden_attrs = get_attrs(scope.superclass) scope.class_variable_set hidden_attrs_variable_name, hidden_attrs + attrs rescue NameError => e scope.class_variable_set hidden_attrs_variable_name, Set.new(attrs) end end |
.get_attrs(scope) ⇒ Object
77 78 79 |
# File 'lib/attr_init.rb', line 77 def self.get_attrs(scope) scope.class_variable_get hidden_attrs_variable_name end |
.hidden_attrs_variable_name ⇒ Object
81 82 83 |
# File 'lib/attr_init.rb', line 81 def self.hidden_attrs_variable_name :@@_hidden_attrs end |