Class: Fog::Parsers::Base
- Inherits:
-
Nokogiri::XML::SAX::Document
- Object
- Nokogiri::XML::SAX::Document
- Fog::Parsers::Base
- Defined in:
- lib/fog/parsers/base.rb
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #attr_value(name, attrs) ⇒ Object
- #characters(string) ⇒ Object
- #end_element_namespace(name, prefix = nil, uri = nil) ⇒ Object
-
#initialize ⇒ Base
constructor
A new instance of Base.
- #reset ⇒ Object
-
#start_element(name, attrs = []) ⇒ Object
###############################################################################.
-
#start_element_namespace(name, attrs = [], prefix = nil, uri = nil, ns = []) ⇒ Object
############################################################################### This is a workaround.
- #value ⇒ Object
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
8 9 10 |
# File 'lib/fog/parsers/base.rb', line 8 def initialize reset end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
6 7 8 |
# File 'lib/fog/parsers/base.rb', line 6 def response @response end |
Instance Method Details
#attr_value(name, attrs) ⇒ Object
12 13 14 |
# File 'lib/fog/parsers/base.rb', line 12 def attr_value(name, attrs) (entry = attrs.find {|a| a.localname == name }) && entry.value end |
#characters(string) ⇒ Object
20 21 22 23 |
# File 'lib/fog/parsers/base.rb', line 20 def characters(string) @value ||= '' @value << string end |
#end_element_namespace(name, prefix = nil, uri = nil) ⇒ Object
32 33 34 |
# File 'lib/fog/parsers/base.rb', line 32 def end_element_namespace name, prefix = nil, uri = nil end_element name end |
#reset ⇒ Object
16 17 18 |
# File 'lib/fog/parsers/base.rb', line 16 def reset @response = {} end |
#start_element(name, attrs = []) ⇒ Object
###############################################################################
38 39 40 |
# File 'lib/fog/parsers/base.rb', line 38 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.
28 29 30 |
# File 'lib/fog/parsers/base.rb', line 28 def start_element_namespace name, attrs = [], prefix = nil, uri = nil, ns = [] start_element name, attrs end |
#value ⇒ Object
42 43 44 |
# File 'lib/fog/parsers/base.rb', line 42 def value @value && @value.dup end |