Module: Kwaff
- Defined in:
- lib/kwaff/errors.rb,
lib/kwaff.rb,
lib/kwaff/node.rb,
lib/kwaff/rexml.rb,
lib/kwaff/parser.rb,
lib/kwaff/doctype.rb,
lib/kwaff/optparse.rb,
lib/kwaff/translator.rb,
lib/kwaff/orderedhash.rb
Overview
hash which keeps order of keys added into itself
$Id: orderedhash.rb 7 2005-05-18 14:33:37Z kwatch $ $Release: 1.0.0 $ copyright© 2005 kuwata-lab.com all rights reserved
Defined Under Namespace
Modules: Rexml Classes: AssertionError, CommandOptionError, CommandOptionParser, Comment, DocType, Document, Element, KwaffError, KwaffTranslator, Node, NotImplementedError, OrderedHash, ParseError, Parser, RexmlTranslator, Text, TranslationError, Translator, XmlTranslator
Constant Summary collapse
- VERSION =
('$Rev: 7 $' =~ /\d+(?:\.\d+)*/ && $&)
- LAST_UPDATE =
('$Date: 2005-05-18 23:33:37 +0900 (Wed, 18 May 2005) $' =~ /\d\d\d\d[-\/]\d\d[-\/]\d\d/ && $&)
Class Method Summary collapse
- .assert(message = nil) ⇒ Object
-
.convert(kwaff_str, toppings = {}) ⇒ Object
convert Kwaff string to XML string.
-
.parse_document(input, toppings = {}) ⇒ Object
ex.
Class Method Details
.assert(message = nil) ⇒ Object
22 23 24 25 |
# File 'lib/kwaff/errors.rb', line 22 def self.assert(=nil) linenum = caller()[0] AssertionError.new(linenum, ) end |
.convert(kwaff_str, toppings = {}) ⇒ Object
convert Kwaff string to XML string
ex.
kwaff_str = File.open('file.kwaff') { |f| f.read }
xml_str = Kwaff::convert(kwaff_str)
264 265 266 267 268 269 270 271 272 273 |
# File 'lib/kwaff/translator.rb', line 264 def self.convert(kwaff_str, toppings={}) parser = Parser.new(kwaff_str, toppings) document = parser.parse_document() if !toppings.key?(:newline) toppings[:newline] = parser.newline end translator = Kwaff::XmlTranslator.new(toppings) xml_str = translator.translate(document) return xml_str end |
.parse_document(input, toppings = {}) ⇒ Object
ex.
kwaff_str = File.open('file.kwaff') { |f| f.read }
kwaff_document = Kwaff::parse_document(kwaff_str)
xml_str = kwaff_document.to_xml
338 339 340 |
# File 'lib/kwaff/parser.rb', line 338 def self.parse_document(input, toppings={}) return Parser.new(input, toppings).parse_document() end |