Class: Handsoap::XmlQueryFront::NokogiriDriver

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

Overview

TODO:

move these extensions straight to the nokogiri layer

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)


45
46
47
48
49
# File 'lib/jiraSOAP/handsoap_extensions.rb', line 45

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)


53
54
55
56
57
# File 'lib/jiraSOAP/handsoap_extensions.rb', line 53

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



74
75
76
# File 'lib/jiraSOAP/handsoap_extensions.rb', line 74

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



80
81
82
# File 'lib/jiraSOAP/handsoap_extensions.rb', line 80

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])


68
69
70
# File 'lib/jiraSOAP/handsoap_extensions.rb', line 68

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

#to_urlURI::HTTP, NSURL

Returns:



60
61
62
63
64
# File 'lib/jiraSOAP/handsoap_extensions.rb', line 60

def to_url
  temp = self.to_s
  return unless temp
  JIRA.url_class.send JIRA.url_init_method, temp
end