Class: XmlInKdl::Decoder
- Inherits:
-
Object
- Object
- XmlInKdl::Decoder
- Defined in:
- lib/xml_in_kdl/decoder.rb
Class Method Summary collapse
Instance Method Summary collapse
- #decode ⇒ Object
-
#initialize(kdl) ⇒ Decoder
constructor
A new instance of Decoder.
Constructor Details
#initialize(kdl) ⇒ Decoder
Returns a new instance of Decoder.
5 6 7 8 |
# File 'lib/xml_in_kdl/decoder.rb', line 5 def initialize(kdl) @kdl = kdl @xml_doc = ::Nokogiri::XML::Document.new end |
Class Method Details
.decode(kdl) ⇒ Object
10 11 12 |
# File 'lib/xml_in_kdl/decoder.rb', line 10 def self.decode(kdl) new(kdl).decode end |
Instance Method Details
#decode ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/xml_in_kdl/decoder.rb', line 14 def decode @kdl.nodes.each do |kdl_node| xml_node = decode_node(kdl_node) @xml_doc.add_child(xml_node) unless xml_node.nil? end @xml_doc end |