Class: KjDotXml
- Inherits:
-
Object
- Object
- KjDotXml
- Defined in:
- lib/kjdotxml.rb
Instance Method Summary collapse
- #book(s) ⇒ Object
- #books ⇒ Object
-
#initialize(title = nil) ⇒ KjDotXml
constructor
A new instance of KjDotXml.
- #to_doc ⇒ Object
Constructor Details
#initialize(title = nil) ⇒ KjDotXml
Returns a new instance of KjDotXml.
82 83 84 |
# File 'lib/kjdotxml.rb', line 82 def initialize(title=nil) book(title) if title end |
Instance Method Details
#book(s) ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/kjdotxml.rb', line 86 def book(s) filename = s.downcase.gsub(/\s/,'-') + '.xml' #filepath = File.join('/tmp', filename) filepath = File.join(File.dirname(__FILE__), '..', 'xml', filename) if File.exists? filepath then contents = File.read(filepath) @doc = Rexle.new(contents) else raise KjDotXmlError, 'book not found' end end |
#books ⇒ Object
103 104 105 |
# File 'lib/kjdotxml.rb', line 103 def books() BOOKS end |
#to_doc ⇒ Object
107 108 109 |
# File 'lib/kjdotxml.rb', line 107 def to_doc() @doc end |