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.
27 28 29 |
# File 'lib/db/model/statement/tuple.rb', line 27 def initialize(values) @values = values end |
Instance Attribute Details
#values ⇒ Object (readonly)
Returns the value of attribute values.
31 32 33 |
# File 'lib/db/model/statement/tuple.rb', line 31 def values @values end |
Instance Method Details
#append_to(statement) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/db/model/statement/tuple.rb', line 33 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
48 49 50 |
# File 'lib/db/model/statement/tuple.rb', line 48 def eql?(other) self.class.eql?(other.class) && self.values.eql?(other.values) end |
#hash ⇒ Object
52 53 54 |
# File 'lib/db/model/statement/tuple.rb', line 52 def hash [self.class, @values].hash end |