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.



514
515
516
# File 'lib/dm-core/query.rb', line 514

def direction
  @direction
end

#propertyObject (readonly)

Returns the value of attribute property.



514
515
516
# File 'lib/dm-core/query.rb', line 514

def property
  @property
end

Instance Method Details

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



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

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

#hashObject



523
524
525
# File 'lib/dm-core/query.rb', line 523

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

#inspectObject



531
532
533
# File 'lib/dm-core/query.rb', line 531

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

#reverseObject



527
528
529
# File 'lib/dm-core/query.rb', line 527

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