Class: Strict::Reader::Module
- Inherits:
-
Module
- Object
- Module
- Strict::Reader::Module
- Defined in:
- lib/strict/reader/module.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
Instance Method Summary collapse
-
#initialize(configuration) ⇒ Module
constructor
A new instance of Module.
- #inspect ⇒ Object
Constructor Details
#initialize(configuration) ⇒ Module
Returns a new instance of Module.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/strict/reader/module.rb', line 8 def initialize(configuration) super() @configuration = configuration const_set(Strict::Attributes::Class::CONSTANT, configuration) configuration.attributes.each do |attribute| module_eval( "def #{attribute.name} = #{attribute.instance_variable}", # def name = @instance_variable __FILE__, __LINE__ - 2 ) end end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
6 7 8 |
# File 'lib/strict/reader/module.rb', line 6 def configuration @configuration end |
Instance Method Details
#inspect ⇒ Object
22 23 24 |
# File 'lib/strict/reader/module.rb', line 22 def inspect "#<#{self.class} (#{configuration.attributes.map(&:name).join(', ')})>" end |