Class: CqlRuby::CqlPrefixNode

Inherits:
CqlNode
  • Object
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(name = nil, identifier = nil, new_subtree = nil) ⇒ CqlPrefixNode

Returns a new instance of CqlPrefixNode.



67
68
69
70
71
# File 'lib/cql_ruby/cql_nodes.rb', line 67

def initialize( name=nil, identifier=nil, new_subtree=nil )
  super()
  @prefix = CqlPrefix.new( name, identifier )
  @subtree = new_subtree
end

Instance Attribute Details

#prefixObject

Returns the value of attribute prefix.



66
67
68
# File 'lib/cql_ruby/cql_nodes.rb', line 66

def prefix
  @prefix
end

#subtreeObject

Returns the value of attribute subtree.



66
67
68
# File 'lib/cql_ruby/cql_nodes.rb', line 66

def subtree
  @subtree
end

Instance Method Details

#to_cqlObject



73
74
75
76
77
78
79
# File 'lib/cql_ruby/cql_nodes.rb', line 73

def to_cql
  if @prefix.name 
    ">#{@prefix.name}=\"#{@prefix.identifier}\" (#{@subtree.to_cql})"
  else
    ">\"#{@prefix.identifier}\" (#{@subtree.to_cql})"
  end
end

#to_xcql(xml = nil, prefixes = nil, sortkeys = nil) ⇒ Object



81
82
83
84
85
86
87
88
# File 'lib/cql_ruby/cql_nodes.rb', line 81

def to_xcql( xml=nil, prefixes=nil, sortkeys=nil )
  xml = check_xml( xml )
  tmp = []
  tmp = prefixes.dup if prefixes
  tmp << @prefix
  
  @subtree.to_xcql( xml, tmp, sortkeys )
end