Class: DataMapper::Query::Direction

Inherits:
Object
  • Object
show all
Includes:
Assertions
Defined in:
lib/gems/dm-core-0.9.7/lib/dm-core/query.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Assertions

#assert_kind_of

Instance Attribute Details

#directionObject (readonly)

Returns the value of attribute direction.



517
518
519
# File 'lib/gems/dm-core-0.9.7/lib/dm-core/query.rb', line 517

def direction
  @direction
end

#propertyObject (readonly)

Returns the value of attribute property.



517
518
519
# File 'lib/gems/dm-core-0.9.7/lib/dm-core/query.rb', line 517

def property
  @property
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



519
520
521
522
# File 'lib/gems/dm-core-0.9.7/lib/dm-core/query.rb', line 519

def ==(other)
  return true if super
  hash == other.hash
end

#hashObject



526
527
528
# File 'lib/gems/dm-core-0.9.7/lib/dm-core/query.rb', line 526

def hash
  @property.hash + @direction.hash
end

#inspectObject



534
535
536
# File 'lib/gems/dm-core-0.9.7/lib/dm-core/query.rb', line 534

def inspect
  "#<#{self.class.name} #{@property.inspect} #{@direction}>"
end

#reverseObject



530
531
532
# File 'lib/gems/dm-core-0.9.7/lib/dm-core/query.rb', line 530

def reverse
  self.class.new(@property, @direction == :asc ? :desc : :asc)
end