Class: CqlRuby::Modifier

Inherits:
CqlNode show all
Defined in:
lib/cql_ruby/cql_nodes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from CqlNode

#check_xml, #getResultSetName, #render_prefixes, #render_sortkeys, #to_solr

Constructor Details

#initialize(new_type, new_comparison = nil, new_value = nil) ⇒ Modifier

Returns a new instance of Modifier.



94
95
96
97
98
99
# File 'lib/cql_ruby/cql_nodes.rb', line 94

def initialize( new_type, new_comparison=nil, new_value=nil)
  super()
  @type = new_type
  @comparison = new_comparison
  @value = new_value
end

Instance Attribute Details

#comparisonObject

Returns the value of attribute comparison.



92
93
94
# File 'lib/cql_ruby/cql_nodes.rb', line 92

def comparison
  @comparison
end

#typeObject

Returns the value of attribute type.



92
93
94
# File 'lib/cql_ruby/cql_nodes.rb', line 92

def type
  @type
end

#valueObject

Returns the value of attribute value.



92
93
94
# File 'lib/cql_ruby/cql_nodes.rb', line 92

def value
  @value
end

Instance Method Details

#to_cqlObject



101
102
103
104
105
# File 'lib/cql_ruby/cql_nodes.rb', line 101

def to_cql
  res = "#{@type}"
  res << " #{@comparison} #{@value}" if @value
  res
end

#to_xcql(xml = nil, relation_element = "unknown_relation") ⇒ Object



107
108
109
110
111
112
113
114
115
116
# File 'lib/cql_ruby/cql_nodes.rb', line 107

def to_xcql( xml=nil, relation_element="unknown_relation" )
  xml = check_xml( xml )
  xml.modifier do 
    xml.type( @type )
    if( @value )
      xml.tag!( relation_element, @comparison ) if @comparison
      xml.value( @value )
    end
  end
end