Class: CqlRuby::CqlSortNode
- Defined in:
- lib/cql_ruby/cql_nodes.rb
Instance Attribute Summary collapse
-
#keys ⇒ Object
Returns the value of attribute keys.
-
#subtree ⇒ Object
Returns the value of attribute subtree.
Instance Method Summary collapse
- #add_sort_index(key) ⇒ Object
-
#initialize(subtree) ⇒ CqlSortNode
constructor
A new instance of CqlSortNode.
- #to_cql ⇒ Object
- #to_xcql(xml = nil, prefixes = nil, sortkeys = nil) ⇒ Object
Methods inherited from CqlNode
#check_xml, #getResultSetName, #render_prefixes, #render_sortkeys, #to_solr
Constructor Details
#initialize(subtree) ⇒ CqlSortNode
Returns a new instance of CqlSortNode.
296 297 298 299 300 |
# File 'lib/cql_ruby/cql_nodes.rb', line 296 def initialize( subtree ) super() @subtree = subtree @keys = [] end |
Instance Attribute Details
#keys ⇒ Object
Returns the value of attribute keys.
294 295 296 |
# File 'lib/cql_ruby/cql_nodes.rb', line 294 def keys @keys end |
#subtree ⇒ Object
Returns the value of attribute subtree.
294 295 296 |
# File 'lib/cql_ruby/cql_nodes.rb', line 294 def subtree @subtree end |
Instance Method Details
#add_sort_index(key) ⇒ Object
302 303 304 |
# File 'lib/cql_ruby/cql_nodes.rb', line 302 def add_sort_index( key ) @keys << key end |
#to_cql ⇒ Object
313 314 315 316 317 318 319 320 321 322 |
# File 'lib/cql_ruby/cql_nodes.rb', line 313 def to_cql buf = @subtree.to_cql if @keys.any? buf << " sortby " @keys.each do |key| buf << " #{key.to_cql}" end end buf end |
#to_xcql(xml = nil, prefixes = nil, sortkeys = nil) ⇒ Object
306 307 308 309 310 311 |
# File 'lib/cql_ruby/cql_nodes.rb', line 306 def to_xcql( xml=nil, prefixes=nil, sortkeys=nil ) raise CqlException, "CqlSortNode.to_xcql called with sortkeys" if sortkeys and sortkeys.any? xml = check_xml( xml ) return @subtree.to_xcql( xml, prefixes, @keys ) end |