Class: Dachsfisch::XML2JSONConverter
- Inherits:
-
ConverterBase
- Object
- ConverterBase
- Dachsfisch::XML2JSONConverter
- Defined in:
- lib/dachsfisch/xml2_json_converter.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(xml:) ⇒ XML2JSONConverter
constructor
A new instance of XML2JSONConverter.
Methods inherited from ConverterBase
Constructor Details
#initialize(xml:) ⇒ XML2JSONConverter
Returns a new instance of XML2JSONConverter.
5 6 7 8 9 10 |
# File 'lib/dachsfisch/xml2_json_converter.rb', line 5 def initialize(xml:) super() @fragment = Nokogiri::XML::DocumentFragment.parse(xml) raise InvalidXMLInputError.new('input empty') if xml.nil? || xml.empty? raise InvalidXMLInputError.new(@fragment.errors) if @fragment.errors.length.positive? end |