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.
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
#key ⇒ Object (readonly)
Returns the value of attribute key.
56 57 58 |
# File 'lib/db/model/statement/predicate.rb', line 56 def key @key end |
#maximum ⇒ Object (readonly)
Returns the value of attribute maximum.
58 59 60 |
# File 'lib/db/model/statement/predicate.rb', line 58 def maximum @maximum end |
#minimum ⇒ Object (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
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 |
#hash ⇒ Object
72 73 74 |
# File 'lib/db/model/statement/predicate.rb', line 72 def hash [self.class, @key, @minimum, @maximum].hash end |