Class: H2o::FileLoader
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #exist?(file) ⇒ Boolean
-
#initialize(path) ⇒ FileLoader
constructor
A new instance of FileLoader.
- #read(file) ⇒ Object
Constructor Details
#initialize(path) ⇒ FileLoader
Returns a new instance of FileLoader.
5 6 7 8 9 |
# File 'lib/h2o/file_loader.rb', line 5 def initialize(path) raise "Search path not found" unless File.exist?(path) self.path = Pathname.new(path) end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
3 4 5 |
# File 'lib/h2o/file_loader.rb', line 3 def path @path end |
Instance Method Details
#exist?(file) ⇒ Boolean
16 17 18 |
# File 'lib/h2o/file_loader.rb', line 16 def exist?(file) File.exist?(self.path + file) end |
#read(file) ⇒ Object
11 12 13 14 |
# File 'lib/h2o/file_loader.rb', line 11 def read(file) raise "Template not found" unless exist?(file) File.read(self.path + file) end |