Class: VORuby::ADQL::V1_0::Table
- Defined in:
- lib/voruby/adql/1.0/adql.rb
Overview
Represents a table with its name and its alias name
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#table_alias ⇒ Object
Returns the value of attribute table_alias.
-
#xpath_name ⇒ Object
Returns the value of attribute xpath_name.
Class Method Summary collapse
Instance Method Summary collapse
- #==(t) ⇒ Object
-
#initialize(name, table_alias = nil, xpath_name = nil) ⇒ Table
constructor
A new instance of Table.
- #to_s ⇒ Object
- #to_xml(name = nil) ⇒ Object
Methods included from SerializableToXml
Constructor Details
#initialize(name, table_alias = nil, xpath_name = nil) ⇒ Table
Returns a new instance of Table.
840 841 842 843 844 |
# File 'lib/voruby/adql/1.0/adql.rb', line 840 def initialize(name, table_alias=nil, xpath_name=nil) self.name = name self.table_alias = table_alias self.xpath_name = xpath_name end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
836 837 838 |
# File 'lib/voruby/adql/1.0/adql.rb', line 836 def name @name end |
#table_alias ⇒ Object
Returns the value of attribute table_alias.
836 837 838 |
# File 'lib/voruby/adql/1.0/adql.rb', line 836 def table_alias @table_alias end |
#xpath_name ⇒ Object
Returns the value of attribute xpath_name.
836 837 838 |
# File 'lib/voruby/adql/1.0/adql.rb', line 836 def xpath_name @xpath_name end |
Class Method Details
.from_xml(xml) ⇒ Object
881 882 883 884 885 886 887 888 889 890 891 |
# File 'lib/voruby/adql/1.0/adql.rb', line 881 def self.from_xml(xml) root = element_from(xml) table_alias = root.attributes.get_attribute_ns(obj_ns.uri, 'Alias') xpath_name = root.attributes.get_attribute_ns(obj_ns.uri, 'xpathName') self.new( root.attributes.get_attribute_ns(obj_ns.uri, 'Name').value, table_alias ? table_alias.value : nil, xpath_name ? xpath_name.value : nil ) end |
.xml_type ⇒ Object
838 |
# File 'lib/voruby/adql/1.0/adql.rb', line 838 def self.xml_type; 'tableType' end |
Instance Method Details
#==(t) ⇒ Object
859 860 861 862 863 |
# File 'lib/voruby/adql/1.0/adql.rb', line 859 def ==(t) self.name == t.name and self.table_alias == t.table_alias and self.xpath_name == t.xpath_name end |
#to_s ⇒ Object
865 866 867 868 869 |
# File 'lib/voruby/adql/1.0/adql.rb', line 865 def to_s t = self.name t = "#{t} #{self.table_alias}" if self.table_alias t end |
#to_xml(name = nil) ⇒ Object
871 872 873 874 875 876 877 878 879 |
# File 'lib/voruby/adql/1.0/adql.rb', line 871 def to_xml(name=nil) el = super(name) el.attributes["#{obj_ns.prefix}:Name"] = self.name el.attributes["#{obj_ns.prefix}:Alias"] = self.table_alias if self.table_alias el.attributes["#{obj_ns.prefix}:xpathName"] = self.xpath_name if self.xpath_name el end |