Class: VORuby::ADQL::Operations
Class Method Summary collapse
-
.get_columns(path) ⇒ Object
This method returns an array of column names.
-
.get_meta_columns(path) ⇒ Object
This method returns an array of column info.
Class Method Details
.get_columns(path) ⇒ Object
This method returns an array of column names. For now, it reads a file from somewhere path. In the future we’ll have a service that will return a xml file with similar information.
- path
-
It’s temporal param
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/voruby/adql/operations.rb', line 12 def self.get_columns(path) columns_array = [{'name'=>'All'}] document = REXML::Document.new(File.new(path))#This is temporal way raise "Document haven't elements" if document.root == nil document.root.elements.each('String') do |element| columns_array.push({'name'=>element.text}) end return columns_array end |
.get_meta_columns(path) ⇒ Object
This method returns an array of column info. For now, it reads a file from somewhere path. In the future we’ll have a service that will return a xml file with similar information.
- path
-
It’s temporal param
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/voruby/adql/operations.rb', line 30 def self.(path) columns_array = [] document = REXML::Document.new(File.new(path))#This is temporal way raise "Document haven't elements" if document.root == nil document.root.elements.each('MetaColumn') do || node_name = REXML::XPath.first(, 'Name') node_unit = REXML::XPath.first(, 'Unit') node_des = REXML::XPath.first(, 'Description') node_ucd = REXML::XPath.first(, 'UCD') columns_array.push({'name'=> node_name.text, 'unit'=> node_unit.text, 'description'=> node_des.text, 'ucd'=>node_ucd.text}) end return columns_array end |