Class: DataMapper::Query::Direction

Inherits:
Object
  • Object
show all
Includes:
Assertions
Defined in:
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.



565
566
567
# File 'lib/dm-core/query.rb', line 565

def direction
  @direction
end

#propertyObject (readonly)

Returns the value of attribute property.



565
566
567
# File 'lib/dm-core/query.rb', line 565

def property
  @property
end

Instance Method Details

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



567
568
569
570
# File 'lib/dm-core/query.rb', line 567

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

#hashObject



574
575
576
# File 'lib/dm-core/query.rb', line 574

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

#inspectObject



582
583
584
# File 'lib/dm-core/query.rb', line 582

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

#reverseObject



578
579
580
# File 'lib/dm-core/query.rb', line 578

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