Class Index [+]

Quicksearch

DataMapper::Query::Conditions::RelationshipHandler

Included into comparisons which are capable of supporting Relationships.

Public Instance Methods

foreign_key_mapping() click to toggle source

Returns the conditions required to match the subject relationship

@return [Hash]

@api semipublic

     # File lib/dm-core/query/conditions/comparison.rb, line 470
470:         def foreign_key_mapping
471:           relationship = subject.inverse
472:           relationship = relationship.links.first if relationship.respond_to?(:links)
473: 
474:           Query.target_conditions(value, relationship.source_key, relationship.target_key)
475:         end
matches?(record) click to toggle source

Tests that the record value matches the comparison

@param [Resource, Hash] record

  The record containing the value to be matched

@return [Boolean]

@api semipublic

     # File lib/dm-core/query/conditions/comparison.rb, line 457
457:         def matches?(record)
458:           if relationship? && expected.respond_to?(:query)
459:             match_relationship?(record)
460:           else
461:             super
462:           end
463:         end
relationship?() click to toggle source

Returns whether this comparison subject is a Relationship

@return [Boolean]

@api semipublic

     # File lib/dm-core/query/conditions/comparison.rb, line 445
445:         def relationship?
446:           subject.kind_of?(Associations::Relationship)
447:         end

Private Instance Methods

dump() click to toggle source

@api private

     # File lib/dm-core/query/conditions/comparison.rb, line 500
500:         def dump
501:           if relationship?
502:             dump_relationship(loaded_value)
503:           else
504:             super
505:           end
506:         end
dump_relationship(value) click to toggle source

@api private

     # File lib/dm-core/query/conditions/comparison.rb, line 509
509:         def dump_relationship(value)
510:           value
511:         end
match_relationship?(record) click to toggle source

@api private

     # File lib/dm-core/query/conditions/comparison.rb, line 480
480:         def match_relationship?(record)
481:           expected.query.conditions.matches?(record_value(record))
482:         end
typecast(value) click to toggle source

Typecasts each value in the inclusion set

@return [Array]

@see AbtractComparison#typecast

@api private

     # File lib/dm-core/query/conditions/comparison.rb, line 491
491:         def typecast(value)
492:           if relationship?
493:             typecast_relationship(value)
494:           else
495:             super
496:           end
497:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.