Class: Handsoap::XmlQueryFront::NokogiriDriver
- Inherits:
-
Object
- Object
- Handsoap::XmlQueryFront::NokogiriDriver
- Defined in:
- lib/jiraSOAP/handsoap_extensions.rb
Overview
Simple extensions on the existing Handsoap class to make parsing easier.
Instance Method Summary collapse
-
#to_date_string ⇒ Time
Parses non-strict date strings into Time objects.
-
#to_hex_string ⇒ String
This is a bit naive, but should be sufficient for its purpose.
-
#to_object(klass) ⇒ Object
An instance of klass.
-
#to_objects(klass) ⇒ Array
An array of klass objects.
-
#to_ss ⇒ [String]
Returns the node’s children to an array of strings.
- #to_url ⇒ URL
Instance Method Details
#to_date_string ⇒ Time
Parses non-strict date strings into Time objects.
43 44 45 46 47 |
# File 'lib/jiraSOAP/handsoap_extensions.rb', line 43 def to_date_string temp = self.to_s return unless temp Time.new temp end |
#to_hex_string ⇒ String
This is a bit naive, but should be sufficient for its purpose.
51 52 53 54 55 |
# File 'lib/jiraSOAP/handsoap_extensions.rb', line 51 def to_hex_string temp = self.to_s return unless temp temp.match(/#(..)(..)(..)/).captures end |
#to_object(klass) ⇒ Object
Returns an instance of klass.
72 73 74 |
# File 'lib/jiraSOAP/handsoap_extensions.rb', line 72 def to_object klass klass.new_with_xml self end |
#to_objects(klass) ⇒ Array
Returns an array of klass objects.
78 79 80 |
# File 'lib/jiraSOAP/handsoap_extensions.rb', line 78 def to_objects klass children.map { |node| klass.new_with_xml node } end |
#to_ss ⇒ [String]
Returns the node’s children to an array of strings.
66 67 68 |
# File 'lib/jiraSOAP/handsoap_extensions.rb', line 66 def to_ss children.map { |val| val.to_s } end |
#to_url ⇒ URL
58 59 60 61 62 |
# File 'lib/jiraSOAP/handsoap_extensions.rb', line 58 def to_url temp = self.to_s return unless temp URL.new temp end |