Class: VORuby::ADQL::V1_0::LikePred

Inherits:
Search
  • Object
show all
Defined in:
lib/voruby/adql/1.0/adql.rb

Overview

The Like expression of a query

Direct Known Subclasses

NotLikePred

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SerializableToXml

#element

Constructor Details

#initialize(arg, pattern) ⇒ LikePred

Returns a new instance of LikePred.



1228
1229
1230
1231
# File 'lib/voruby/adql/1.0/adql.rb', line 1228

def initialize(arg, pattern)
  self.arg = arg
  self.pattern = pattern
end

Instance Attribute Details

#argObject

Returns the value of attribute arg.



1224
1225
1226
# File 'lib/voruby/adql/1.0/adql.rb', line 1224

def arg
  @arg
end

#patternObject

Returns the value of attribute pattern.



1224
1225
1226
# File 'lib/voruby/adql/1.0/adql.rb', line 1224

def pattern
  @pattern
end

Class Method Details

.from_xml(xml) ⇒ Object



1267
1268
1269
1270
1271
1272
1273
1274
# File 'lib/voruby/adql/1.0/adql.rb', line 1267

def self.from_xml(xml)
  root = element_from(xml)
  
  self.new(
    xml_to_obj(REXML::XPath.first(root, 'x:Arg', {'x' => obj_ns.uri})),
    xml_to_obj(REXML::XPath.first(root, 'x:Pattern', {'x' => obj_ns.uri}))
  )
end

.xml_typeObject



1226
# File 'lib/voruby/adql/1.0/adql.rb', line 1226

def self.xml_type; 'likePredType' end

Instance Method Details

#==(p) ⇒ Object



1248
1249
1250
1251
# File 'lib/voruby/adql/1.0/adql.rb', line 1248

def ==(p)
  self.arg == p.arg and
  self.pattern == p.pattern
end

#to_sObject



1253
1254
1255
# File 'lib/voruby/adql/1.0/adql.rb', line 1253

def to_s
  "#{arg} LIKE #{pattern}"
end

#to_xml(name = nil) ⇒ Object



1257
1258
1259
1260
1261
1262
1263
1264
1265
# File 'lib/voruby/adql/1.0/adql.rb', line 1257

def to_xml(name=nil)
  el = super(name)
  
  el.add_element(self.arg.to_xml('Arg'))
  el.add_element(self.pattern.to_xml('Pattern'))
  
  collapse_namespaces(el)
  el
end