Class: DB::Model::Statement::Predicate::Between
- Inherits:
-
Object
- Object
- DB::Model::Statement::Predicate::Between
- Defined in:
- lib/db/model/statement/predicate.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#maximum ⇒ Object
readonly
Returns the value of attribute maximum.
-
#minimum ⇒ Object
readonly
Returns the value of attribute minimum.
Instance Method Summary collapse
- #append_to(statement) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(key, minimum, maximum) ⇒ Between
constructor
A new instance of Between.
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
#key ⇒ Object (readonly)
Returns the value of attribute key.
39 40 41 |
# File 'lib/db/model/statement/predicate.rb', line 39 def key @key end |
#maximum ⇒ Object (readonly)
Returns the value of attribute maximum.
41 42 43 |
# File 'lib/db/model/statement/predicate.rb', line 41 def maximum @maximum end |
#minimum ⇒ Object (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
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 |
#hash ⇒ Object
55 56 57 |
# File 'lib/db/model/statement/predicate.rb', line 55 def hash [self.class, @key, @minimum, @maximum].hash end |