Class: Stepmod::Utils::StepmodDefinitionConverter

Inherits:
Object
  • Object
show all
Defined in:
lib/stepmod/utils/stepmod_definition_converter.rb

Class Method Summary collapse

Class Method Details

.convert(input, options = {}) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/stepmod/utils/stepmod_definition_converter.rb', line 39

def self.convert(input, options = {})
  root = if input.is_a?(String)
            then Nokogiri::XML(input).root
          elsif input.is_a?(Nokogiri::XML::Document)
            then input.root
          elsif input.is_a?(Nokogiri::XML::Node)
            then input
          end

  root || (return '')

  ReverseAdoc.config.with(options) do
    result = ReverseAdoc::Converters.lookup(root.name).convert(root)
    ReverseAdoc.cleaner.tidy(result)
  end
end