Class: CassandraDB::QueryCondition
- Inherits:
-
Object
- Object
- CassandraDB::QueryCondition
- Defined in:
- lib/cassandra_db/query_condition.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#operator ⇒ Object
readonly
Returns the value of attribute operator.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(field, value) ⇒ QueryCondition
constructor
A new instance of QueryCondition.
- #to_argument ⇒ Object
- #to_cql ⇒ Object
Constructor Details
#initialize(field, value) ⇒ QueryCondition
Returns a new instance of QueryCondition.
6 7 8 9 10 |
# File 'lib/cassandra_db/query_condition.rb', line 6 def initialize(field, value) @field = field @value = value @operator = value.is_a?(Array) ? 'IN' : '=' end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
4 5 6 |
# File 'lib/cassandra_db/query_condition.rb', line 4 def field @field end |
#operator ⇒ Object (readonly)
Returns the value of attribute operator.
4 5 6 |
# File 'lib/cassandra_db/query_condition.rb', line 4 def operator @operator end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
4 5 6 |
# File 'lib/cassandra_db/query_condition.rb', line 4 def value @value end |
Instance Method Details
#to_argument ⇒ Object
16 17 18 |
# File 'lib/cassandra_db/query_condition.rb', line 16 def to_argument {field => value} end |
#to_cql ⇒ Object
12 13 14 |
# File 'lib/cassandra_db/query_condition.rb', line 12 def to_cql "#{field} #{operator} :#{field}" end |