class Modulobe::Model

Public Class Methods

extract_info(wabisabi) click to toggle source
# File vendor/qwik/lib/qwik/mdlb-model.rb, line 32
def self.extract_info(wabisabi)
  info = wabisabi.get_path('//model/info')
  return nil if info.nil?
  name    = info.get_path('/name').text.set_xml_charset.to_page_charset
  author  = info.get_path('/author').text.set_xml_charset.to_page_charset
  comment = info.get_path('/comment').text.set_xml_charset.to_page_charset
  return name, author, comment
end
extract_world(wabisabi) click to toggle source
# File vendor/qwik/lib/qwik/mdlb-model.rb, line 25
def self.extract_world(wabisabi)
  world = wabisabi.get_path('//world')
  return nil if world.nil?
  speed = world.get_path('/speed').text
  return speed
end
new(xml) click to toggle source
# File vendor/qwik/lib/qwik/mdlb-model.rb, line 14
def initialize(xml)
  @wabisabi = Model.parse_xml(xml)
  @speed = Model.extract_world(@wabisabi)
  @name, @author, @comment = Model.extract_info(@wabisabi)
end
parse_xml(xml) click to toggle source
# File vendor/qwik/lib/qwik/mdlb-model.rb, line 20
def self.parse_xml(xml)
  xml ||= ''
  return HTree(xml).to_wabisabi
end