Class: CFoundry::V2::ModelMagic::QueryValueHelper::QueryValue
- Inherits:
-
Object
- Object
- CFoundry::V2::ModelMagic::QueryValueHelper::QueryValue
- Defined in:
- lib/cfoundry/v2/model_magic/query_value_helper.rb
Instance Attribute Summary collapse
-
#comparator ⇒ Object
Returns the value of attribute comparator.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #comparator_string ⇒ Object
-
#initialize(params) ⇒ QueryValue
constructor
A new instance of QueryValue.
- #to_s ⇒ Object
- #value_string ⇒ Object
Constructor Details
#initialize(params) ⇒ QueryValue
Returns a new instance of QueryValue.
6 7 8 9 |
# File 'lib/cfoundry/v2/model_magic/query_value_helper.rb', line 6 def initialize(params) self.comparator = params[:comparator] || params[:comp] || ':' self.value = params[:value] end |
Instance Attribute Details
#comparator ⇒ Object
Returns the value of attribute comparator.
5 6 7 |
# File 'lib/cfoundry/v2/model_magic/query_value_helper.rb', line 5 def comparator @comparator end |
#value ⇒ Object
Returns the value of attribute value.
5 6 7 |
# File 'lib/cfoundry/v2/model_magic/query_value_helper.rb', line 5 def value @value end |
Instance Method Details
#comparator_string ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/cfoundry/v2/model_magic/query_value_helper.rb', line 15 def comparator_string if comparator.downcase == 'in' || value.is_a?(Array) " IN " else comparator end end |
#to_s ⇒ Object
11 12 13 |
# File 'lib/cfoundry/v2/model_magic/query_value_helper.rb', line 11 def to_s "#{comparator_string}#{value_string}" end |
#value_string ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/cfoundry/v2/model_magic/query_value_helper.rb', line 23 def value_string if value.is_a? Array value.join(",") else value end end |