Module: Prmd::MultiLoader::Loader
Overview
Base Loader module used to extend all other loaders
Instance Method Summary collapse
-
#load_data(data) ⇒ Object
abstract
Using the loader, parse or do whatever magic the loader does to the string to get back data.
-
#load_file(filename) ⇒ Object
Load a file given a
filename
. -
#load_stream(stream) ⇒ Object
Load a stream.
Instance Method Details
#load_data(data) ⇒ Object
This method is abstract.
Using the loader, parse or do whatever magic the loader does to the string to get back data.
90 91 92 |
# File 'lib/prmd/multi_loader/loader.rb', line 90 def load_data(data) # overwrite in children end |
#load_file(filename) ⇒ Object
Load a file given a filename
111 112 113 |
# File 'lib/prmd/multi_loader/loader.rb', line 111 def load_file(filename) File.open(filename, 'r') { |f| return load_stream(f) } end |
#load_stream(stream) ⇒ Object
Load a stream
101 102 103 |
# File 'lib/prmd/multi_loader/loader.rb', line 101 def load_stream(stream) load_data(stream.read) end |