class Arethusa::CLI::Transformer

Public Instance Methods

parse(type, method) click to toggle source
# File lib/arethusa/cli/transformer.rb, line 20
def parse(type, method)
  @doc.xpath("//xmlns:table[@type = '#{type}']/xmlns:entry").each do |entry|
    short = entry.xpath('./xmlns:tb').text
    next if short == '-' || short.empty?
    long  = entry.xpath('./xmlns:menu').text
    @conf.send(method, stripped(short), stripped(long))
  end
end
relations(file) click to toggle source
# File lib/arethusa/cli/transformer.rb, line 9
def relations(file)
  @doc = Nokogiri::XML(open(file))
  @conf = Relations.new

  parse('relation', :add_label)
  parse('subrelation', :add_suffix)

  puts JSON.pretty_generate(@conf, indent: '  ')
end
stripped(str) click to toggle source
# File lib/arethusa/cli/transformer.rb, line 29
def stripped(str)
  str.sub(/^_/, '')
end