Class: Fog::Parsers::Compute::ProfitBricks::Base

Inherits:
Nokogiri::XML::SAX::Document
  • Object
show all
Defined in:
lib/fog/parsers/compute/profit_bricks/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBase



10
11
12
# File 'lib/fog/parsers/compute/profit_bricks/base.rb', line 10

def initialize
  reset
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



8
9
10
# File 'lib/fog/parsers/compute/profit_bricks/base.rb', line 8

def response
  @response
end

Instance Method Details

#attr_value(name, attrs) ⇒ Object



14
15
16
# File 'lib/fog/parsers/compute/profit_bricks/base.rb', line 14

def attr_value(name, attrs)
  (entry = attrs.find {|a, v| a == name }) && entry.last
end

#characters(string) ⇒ Object



22
23
24
25
# File 'lib/fog/parsers/compute/profit_bricks/base.rb', line 22

def characters(string)
  @value ||= ''
  @value << string
end

#end_element_namespace(name, prefix = nil, uri = nil) ⇒ Object



34
35
36
# File 'lib/fog/parsers/compute/profit_bricks/base.rb', line 34

def end_element_namespace name, prefix = nil, uri = nil
  end_element name
end

#resetObject



18
19
20
# File 'lib/fog/parsers/compute/profit_bricks/base.rb', line 18

def reset
  @response = {}
end

#start_element(name, attrs = []) ⇒ Object

###############################################################################



40
41
42
# File 'lib/fog/parsers/compute/profit_bricks/base.rb', line 40

def start_element(name, attrs = [])
  @value = nil
end

#start_element_namespace(name, attrs = [], prefix = nil, uri = nil, ns = []) ⇒ Object

############################################################################### This is a workaround. Original implementation from Nokogiri is overwritten with one that does not join namespace prefix with local name.



30
31
32
# File 'lib/fog/parsers/compute/profit_bricks/base.rb', line 30

def start_element_namespace name, attrs = [], prefix = nil, uri = nil, ns = []
  start_element name, attrs
end

#valueObject



44
45
46
# File 'lib/fog/parsers/compute/profit_bricks/base.rb', line 44

def value
  @value && @value.dup
end