Class: AttributesReader::Attributes
- Inherits:
-
Object
- Object
- AttributesReader::Attributes
- Defined in:
- lib/attributes_reader.rb
Instance Method Summary collapse
-
#initialize(parent_object) ⇒ Attributes
constructor
A new instance of Attributes.
- #method_missing(m, *args, &block) ⇒ Object
Constructor Details
#initialize(parent_object) ⇒ Attributes
Returns a new instance of Attributes.
5 6 7 |
# File 'lib/attributes_reader.rb', line 5 def initialize parent_object @parent_object = parent_object end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/attributes_reader.rb', line 9 def method_missing(m, *args, &block) if @parent_object.methods.include?("#{m}_expr".intern) @parent_object.send("#{m}_expr", *args) else raise MissingAttributeError.new(m, @parent_object.class) end end |