Class: DB::Model::Statement::Predicate::Between

Inherits:
Object
  • Object
show all
Defined in:
lib/db/model/statement/predicate.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, minimum, maximum) ⇒ Between

Returns a new instance of Between.



50
51
52
53
54
# File 'lib/db/model/statement/predicate.rb', line 50

def initialize(key, minimum, maximum)
	@key = key
	@minimum = minimum
	@maximum = maximum
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



56
57
58
# File 'lib/db/model/statement/predicate.rb', line 56

def key
  @key
end

#maximumObject (readonly)

Returns the value of attribute maximum.



58
59
60
# File 'lib/db/model/statement/predicate.rb', line 58

def maximum
  @maximum
end

#minimumObject (readonly)

Returns the value of attribute minimum.



57
58
59
# File 'lib/db/model/statement/predicate.rb', line 57

def minimum
  @minimum
end

Instance Method Details

#append_to(statement) ⇒ Object



60
61
62
63
64
65
66
# File 'lib/db/model/statement/predicate.rb', line 60

def append_to(statement)
	@key.append_to(statement)
	statement.clause("BETWEEN")
	@minimum.append_to(statement)
	statement.clause("AND")
	@maximum.append_to(statement)
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/db/model/statement/predicate.rb', line 68

def eql?(other)
	self.class.eql?(other.class) && self.key.eql?(other.key) && self.minimum.eql?(other.minimum) && self.maximum.eql?(other.maximum)
end

#hashObject



72
73
74
# File 'lib/db/model/statement/predicate.rb', line 72

def hash
	[self.class, @key, @minimum, @maximum].hash
end