Class: VORuby::ADQL::ConstantListSet

Inherits:
InclusionSet show all
Defined in:
lib/voruby/adql/adql.rb,
lib/voruby/adql/transforms.rb

Overview

Represents a list of constants provided for a SQL IN expression.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(items) ⇒ ConstantListSet

Returns a new instance of ConstantListSet.



2354
2355
2356
# File 'lib/voruby/adql/adql.rb', line 2354

def initialize(items)
  self.items = items
end

Instance Attribute Details

#itemsObject

Returns the value of attribute items.



2352
2353
2354
# File 'lib/voruby/adql/adql.rb', line 2352

def items
  @items
end

Class Method Details

.from_xml(node) ⇒ Object



2386
2387
2388
2389
2390
2391
2392
2393
2394
# File 'lib/voruby/adql/adql.rb', line 2386

def self.from_xml(node)
  item_list = []
  node.elements.each('Item') do |item_node|
    item = Item.from_xml(item_node)
    item_list.push(Item.from_xml(item_node))
  end
  
  return ConstantListSet.new(item_list)
end

Instance Method Details

#to_adqlsObject



477
478
479
480
481
482
483
484
485
# File 'lib/voruby/adql/transforms.rb', line 477

def to_adqls
  self.items.collect{ |x| 
    if x.is_a?(NumberType)
      x.to_adqls
    else
      "\"#{x.to_adqls}\""
    end
  }.join(', ')
end

#to_sObject



2381
2382
2383
2384
# File 'lib/voruby/adql/adql.rb', line 2381

def to_s
  items = self.items.collect{|x| x.to_s}.join('|')
  "{items=#{items}}"
end