Class: Handsoap::XmlQueryFront::NokogiriDriver

Inherits:
Object
  • Object
show all
Defined in:
lib/jiraSOAP/handsoap_extensions.rb

Overview

Simple extensions on the existing Handsoap class to make parsing easier.

Instance Method Summary collapse

Instance Method Details

#to_date_stringTime

Parses non-strict date strings into Time objects.

Returns:

  • (Time)


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_stringString

This is a bit naive, but should be sufficient for its purpose.

Returns:

  • (String)


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.

Parameters:

  • klass (Class)

    the object you want to make

Returns:

  • (Object)

    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.

Parameters:

  • klass (Class)

    the object you want an array of

Returns:

  • (Array)

    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.

Returns:

  • ([String])


66
67
68
# File 'lib/jiraSOAP/handsoap_extensions.rb', line 66

def to_ss
  children.map { |val| val.to_s }
end

#to_urlURL

Returns:



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