Included Modules

Class Index [+]

Quicksearch

DataMapper::Query::Path

Attributes

repository_name[R]

@api semipublic

relationships[R]

@api semipublic

model[R]

@api semipublic

property[R]

@api semipublic

Public Class Methods

new(relationships, property_name = nil) click to toggle source

@api semipublic

    # File lib/dm-core/query/path.rb, line 80
80:       def initialize(relationships, property_name = nil)
81:         @relationships = relationships.to_ary.dup
82: 
83:         last_relationship = @relationships.last
84:         @repository_name  = last_relationship.relative_target_repository_name
85:         @model            = last_relationship.target_model
86: 
87:         if property_name
88:           property_name = property_name.to_sym
89:           @property = @model.properties(@repository_name)[property_name] ||
90:             raise(ArgumentError, "Unknown property '#{property_name}' in #{@model}")
91:         end
92:       end

Public Instance Methods

asc() click to toggle source

Used for creating :order options. This technique may be deprecated, so marking as semipublic until the issue is resolved.

@api semipublic

    # File lib/dm-core/query/path.rb, line 57
57:       def asc
58:         Operator.new(property, :asc)
59:       end
desc() click to toggle source

Used for creating :order options. This technique may be deprecated, so marking as semipublic until the issue is resolved.

@api semipublic

    # File lib/dm-core/query/path.rb, line 65
65:       def desc
66:         Operator.new(property, :desc)
67:       end
instance_of?(klass) click to toggle source

@api public

    # File lib/dm-core/query/path.rb, line 49
49:       def instance_of?(klass)
50:         super || (defined?(@property) ? @property.instance_of?(klass) : false)
51:       end
kind_of?(klass) click to toggle source

@api public

    # File lib/dm-core/query/path.rb, line 44
44:       def kind_of?(klass)
45:         super || (defined?(@property) ? @property.kind_of?(klass) : false)
46:       end
respond_to?(method, include_private = false) click to toggle source

@api semipublic

    # File lib/dm-core/query/path.rb, line 70
70:       def respond_to?(method, include_private = false)
71:         super                                                                   ||
72:         (defined?(@property) && @property.respond_to?(method, include_private)) ||
73:         @model.relationships(@repository_name).named?(method)                   ||
74:         @model.properties(@repository_name).named?(method)
75:       end

Private Instance Methods

method_missing(method, *args) click to toggle source

@api semipublic

     # File lib/dm-core/query/path.rb, line 95
 95:       def method_missing(method, *args)
 96:         if @property
 97:           return @property.send(method, *args)
 98:         end
 99: 
100:         path_class = self.class
101: 
102:         if relationship = @model.relationships(@repository_name)[method]
103:           return path_class.new(@relationships.dup << relationship)
104:         end
105: 
106:         if @model.properties(@repository_name).named?(method)
107:           return path_class.new(@relationships, method)
108:         end
109: 
110:         raise NoMethodError, "undefined property or relationship '#{method}' on #{@model}"
111:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.