Class: Stepmod::Utils::SmrlDescriptionConverter

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

Class Method Summary collapse

Class Method Details

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



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/stepmod/utils/smrl_description_converter.rb', line 33

def self.convert(input, options = {})
  root = case input
         when String
           Nokogiri::XML(input).root
         when Nokogiri::XML::Document
           input.root
         when Nokogiri::XML::Node
           input
         end

  root || (return "")

  ReverseAdoc.config.with(options) do
    result = ReverseAdoc::Converters.lookup(root.name).convert(root, options)
    Stepmod::Utils::Cleaner.new.tidy(result)
  end
end