Class: Handsoap::XmlQueryFront::NodeSelection

Inherits:
Array
  • Object
show all
Defined in:
lib/handsoap/xml_query_front.rb

Overview

NodeSelection is a wrapper around Array, that implicitly delegates BaseDriver methods to the first element.

It makes mapping code prettier, since you often need to access the first element of a selection.

Instance Method Summary collapse

Instance Method Details

#/(expression) ⇒ Object



93
94
95
# File 'lib/handsoap/xml_query_front.rb', line 93

def /(expression)
  self.first.xpath(expression)
end

#node_nameObject



87
88
89
# File 'lib/handsoap/xml_query_front.rb', line 87

def node_name
  self.first.node_name if self.any?
end

#to_booleanObject



78
79
80
# File 'lib/handsoap/xml_query_front.rb', line 78

def to_boolean
  self.first.to_boolean if self.any?
end

#to_dateObject



81
82
83
# File 'lib/handsoap/xml_query_front.rb', line 81

def to_date
  self.first.to_date if self.any?
end

#to_fObject



75
76
77
# File 'lib/handsoap/xml_query_front.rb', line 75

def to_f
  self.first.to_f if self.any?
end

#to_iObject



72
73
74
# File 'lib/handsoap/xml_query_front.rb', line 72

def to_i
  self.first.to_i if self.any?
end

#to_rawObject



99
100
101
# File 'lib/handsoap/xml_query_front.rb', line 99

def to_raw
  self.first.to_raw if self.any?
end

#to_sObject



84
85
86
# File 'lib/handsoap/xml_query_front.rb', line 84

def to_s
  self.first.to_s if self.any?
end

#to_xmlObject



96
97
98
# File 'lib/handsoap/xml_query_front.rb', line 96

def to_xml
  self.first.to_xml if self.any?
end

#xpath(expression, ns = nil) ⇒ Object



90
91
92
# File 'lib/handsoap/xml_query_front.rb', line 90

def xpath(expression, ns = nil)
  self.first.xpath(expression, ns)
end