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.



33
34
35
36
37
# File 'lib/db/model/statement/predicate.rb', line 33

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

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



39
40
41
# File 'lib/db/model/statement/predicate.rb', line 39

def key
  @key
end

#maximumObject (readonly)

Returns the value of attribute maximum.



41
42
43
# File 'lib/db/model/statement/predicate.rb', line 41

def maximum
  @maximum
end

#minimumObject (readonly)

Returns the value of attribute minimum.



40
41
42
# File 'lib/db/model/statement/predicate.rb', line 40

def minimum
  @minimum
end

Instance Method Details

#append_to(statement) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/db/model/statement/predicate.rb', line 43

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)


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

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



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

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