Class: DB::Model::Statement::Tuple
- Inherits:
-
Object
- Object
- DB::Model::Statement::Tuple
- Defined in:
- lib/db/model/statement/tuple.rb
Instance Attribute Summary collapse
-
#values ⇒ Object
readonly
Returns the value of attribute values.
Instance Method Summary collapse
- #append_to(statement) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(values) ⇒ Tuple
constructor
A new instance of Tuple.
Constructor Details
#initialize(values) ⇒ Tuple
Returns a new instance of Tuple.
10 11 12 |
# File 'lib/db/model/statement/tuple.rb', line 10 def initialize(values) @values = values end |
Instance Attribute Details
#values ⇒ Object (readonly)
Returns the value of attribute values.
14 15 16 |
# File 'lib/db/model/statement/tuple.rb', line 14 def values @values end |
Instance Method Details
#append_to(statement) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/db/model/statement/tuple.rb', line 16 def append_to(statement) first = true statement.clause("(") @values.each do |value| statement.clause(",") unless first first = false statement.literal(value) end statement.clause(")") return statement end |
#eql?(other) ⇒ Boolean
31 32 33 |
# File 'lib/db/model/statement/tuple.rb', line 31 def eql?(other) self.class.eql?(other.class) && self.values.eql?(other.values) end |
#hash ⇒ Object
35 36 37 |
# File 'lib/db/model/statement/tuple.rb', line 35 def hash [self.class, @values].hash end |