Class: KjDotXml

Inherits:
Object
  • Object
show all
Defined in:
lib/kjdotxml.rb

Instance Method Summary collapse

Constructor Details

#initializeKjDotXml

Returns a new instance of KjDotXml.



82
83
# File 'lib/kjdotxml.rb', line 82

def initialize()
end

Instance Method Details

#book(s) ⇒ Object



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/kjdotxml.rb', line 85

def book(s)
  
  #filepath = File.join('/tmp', s.downcase.gsub(/\s/,'-') + '.xml')
  filename = s.downcase.gsub(/\s/,'-') + '.xml'
  filepath = File.join(File.dirname(__FILE__), '..', 'xml', filename)
  
  if File.exists? filepath then
    
    contents = File.read(filepath)
    Rexle.new(contents)
    
  else
    raise KjDotXmlError, 'book not found'
  end
  
end

#booksObject



102
103
104
# File 'lib/kjdotxml.rb', line 102

def books()
  BOOKS
end