Class: Virsandra::CQLValue

Inherits:
Object
  • Object
show all
Defined in:
lib/virsandra/cql_value.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ CQLValue

Returns a new instance of CQLValue.



10
11
12
# File 'lib/virsandra/cql_value.rb', line 10

def initialize(value)
  @value = value
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8
9
10
# File 'lib/virsandra/cql_value.rb', line 8

def value
  @value
end

Class Method Details

.convert(val) ⇒ Object



4
5
6
# File 'lib/virsandra/cql_value.rb', line 4

def self.convert(val)
  new(val).to_cql
end

Instance Method Details

#to_cqlObject



14
15
16
17
18
19
20
21
22
# File 'lib/virsandra/cql_value.rb', line 14

def to_cql
  if value.respond_to?(:to_guid)
    value.to_guid
  elsif should_escape?(value)
    "'#{escape(value)}'"
  else
    value.to_s
  end
end