Class: Decontaminate::Decoder::Hash
- Inherits:
-
Object
- Object
- Decontaminate::Decoder::Hash
- Defined in:
- lib/decontaminate/decoder/hash.rb
Instance Attribute Summary collapse
-
#decontaminator ⇒ Object
readonly
Returns the value of attribute decontaminator.
-
#xpath ⇒ Object
readonly
Returns the value of attribute xpath.
Instance Method Summary collapse
- #decode(this, xml_node) ⇒ Object
-
#initialize(xpath, decontaminator) ⇒ Hash
constructor
A new instance of Hash.
Constructor Details
#initialize(xpath, decontaminator) ⇒ Hash
Returns a new instance of Hash.
6 7 8 9 |
# File 'lib/decontaminate/decoder/hash.rb', line 6 def initialize(xpath, decontaminator) @xpath = xpath @decontaminator = decontaminator end |
Instance Attribute Details
#decontaminator ⇒ Object (readonly)
Returns the value of attribute decontaminator.
4 5 6 |
# File 'lib/decontaminate/decoder/hash.rb', line 4 def decontaminator @decontaminator end |
#xpath ⇒ Object (readonly)
Returns the value of attribute xpath.
4 5 6 |
# File 'lib/decontaminate/decoder/hash.rb', line 4 def xpath @xpath end |
Instance Method Details
#decode(this, xml_node) ⇒ Object
11 12 13 14 |
# File 'lib/decontaminate/decoder/hash.rb', line 11 def decode(this, xml_node) child = xml_node && xml_node.at_xpath(xpath) decontaminator.new(child, instance: this).as_json end |