Class: Lafcadio::Query::DomainObjectImpostor
- Inherits:
-
Object
- Object
- Lafcadio::Query::DomainObjectImpostor
- Defined in:
- lib/lafcadio/query.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#domainClass ⇒ Object
readonly
Returns the value of attribute domainClass.
Instance Method Summary collapse
-
#initialize(domainClass) ⇒ DomainObjectImpostor
constructor
A new instance of DomainObjectImpostor.
- #method_missing(methId, *args) ⇒ Object
Constructor Details
#initialize(domainClass) ⇒ DomainObjectImpostor
Returns a new instance of DomainObjectImpostor.
102 103 104 |
# File 'lib/lafcadio/query.rb', line 102 def initialize( domainClass ) @domainClass = domainClass end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(methId, *args) ⇒ Object
106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/lafcadio/query.rb', line 106 def method_missing( methId, *args ) fieldName = methId.id2name if fieldName == 'pkId' ObjectFieldImpostor.new( self, fieldName ) else begin classField = @domainClass.getField( fieldName ) ObjectFieldImpostor.new( self, classField ) rescue MissingError super( methId, *args ) end end end |
Instance Attribute Details
#domainClass ⇒ Object (readonly)
Returns the value of attribute domainClass.
100 101 102 |
# File 'lib/lafcadio/query.rb', line 100 def domainClass @domainClass end |