Class: DataMapper::Query::Path
- Inherits:
-
Object
- Object
- DataMapper::Query::Path
- Extended by:
- Equalizer
- Includes:
- Extlib::Assertions
- Defined in:
- lib/dm-core/query/path.rb
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
TODO: document.
-
#property ⇒ Object
readonly
TODO: document.
-
#relationships ⇒ Object
readonly
TODO: document.
-
#repository_name ⇒ Object
readonly
TODO: document.
Instance Method Summary collapse
-
#instance_of?(klass) ⇒ Boolean
TODO: document.
-
#kind_of?(klass) ⇒ Boolean
TODO: document.
-
#respond_to?(method, include_private = false) ⇒ Boolean
TODO: document.
Methods included from Equalizer
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object (private)
TODO: document
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/dm-core/query/path.rb', line 85 def method_missing(method, *args) if @property return @property.send(method, *args) end if relationship = @model.relationships(@repository_name)[method] return self.class.new(@relationships.dup << relationship) end if @model.properties(@repository_name).named?(method) return self.class.new(@relationships, method) end raise NoMethodError, "undefined property or relationship '#{method}' on #{@model}" end |
Instance Attribute Details
#model ⇒ Object (readonly)
TODO: document
27 28 29 |
# File 'lib/dm-core/query/path.rb', line 27 def model @model end |
#property ⇒ Object (readonly)
TODO: document
31 32 33 |
# File 'lib/dm-core/query/path.rb', line 31 def property @property end |
#relationships ⇒ Object (readonly)
TODO: document
23 24 25 |
# File 'lib/dm-core/query/path.rb', line 23 def relationships @relationships end |
#repository_name ⇒ Object (readonly)
TODO: document
19 20 21 |
# File 'lib/dm-core/query/path.rb', line 19 def repository_name @repository_name end |
Instance Method Details
#instance_of?(klass) ⇒ Boolean
TODO: document
50 51 52 |
# File 'lib/dm-core/query/path.rb', line 50 def instance_of?(klass) super || (defined?(@property) ? @property.instance_of?(klass) : false) end |
#kind_of?(klass) ⇒ Boolean
TODO: document
44 45 46 |
# File 'lib/dm-core/query/path.rb', line 44 def kind_of?(klass) super || (defined?(@property) ? @property.kind_of?(klass) : false) end |
#respond_to?(method, include_private = false) ⇒ Boolean
TODO: document
56 57 58 59 60 61 |
# File 'lib/dm-core/query/path.rb', line 56 def respond_to?(method, include_private = false) super || (defined?(@property) && @property.respond_to?(method, include_private)) || @model.relationships(@repository_name).key?(method) || @model.properties(@repository_name).named?(method) end |