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.



2406
2407
2408
# File 'lib/voruby/adql/adql.rb', line 2406

def initialize(items)
  self.items = items
end

Instance Attribute Details

#itemsObject

Returns the value of attribute items.



2404
2405
2406
# File 'lib/voruby/adql/adql.rb', line 2404

def items
  @items
end

Class Method Details

.from_xml(node) ⇒ Object



2438
2439
2440
2441
2442
2443
2444
2445
2446
# File 'lib/voruby/adql/adql.rb', line 2438

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



2433
2434
2435
2436
# File 'lib/voruby/adql/adql.rb', line 2433

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