Class: MrMongo::Loader
- Inherits:
-
Object
- Object
- MrMongo::Loader
- Defined in:
- lib/mr_mongo/loader.rb
Instance Method Summary collapse
-
#initialize(context) ⇒ Loader
constructor
A new instance of Loader.
- #load(file) ⇒ Object
- #load_from_string(dsl_script, file = "(Mr. Mongo DSL)") ⇒ Object
Constructor Details
#initialize(context) ⇒ Loader
Returns a new instance of Loader.
5 6 7 |
# File 'lib/mr_mongo/loader.rb', line 5 def initialize(context) @context = context end |
Instance Method Details
#load(file) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/mr_mongo/loader.rb', line 9 def load(file) dsl_script = ::File.read(file).sub!(/^__END__\n.*\Z/m, '') map_reduce = load_from_string(dsl_script, file) InlineTemplateLoader.load(file).each do |key, val| map_reduce.send("#{key}=".to_sym, val) end map_reduce end |