Class: MrMongo::Dsl
- Inherits:
-
Object
- Object
- MrMongo::Dsl
- Defined in:
- lib/mr_mongo/dsl.rb
Instance Attribute Summary collapse
-
#map_reduce ⇒ Object
readonly
Returns the value of attribute map_reduce.
Instance Method Summary collapse
- #default_param(key, value) ⇒ Object
-
#initialize(context) ⇒ Dsl
constructor
A new instance of Dsl.
- #params ⇒ Object
- #parse(&block) ⇒ Object
- #set(key, value = true) ⇒ Object
Constructor Details
Instance Attribute Details
#map_reduce ⇒ Object (readonly)
Returns the value of attribute map_reduce.
3 4 5 |
# File 'lib/mr_mongo/dsl.rb', line 3 def map_reduce @map_reduce end |
Instance Method Details
#default_param(key, value) ⇒ Object
29 30 31 |
# File 'lib/mr_mongo/dsl.rb', line 29 def default_param(key, value) @default_params[key] = value end |
#params ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/mr_mongo/dsl.rb', line 21 def params if @context.params? @default_params.merge(@context.params) else @default_params end end |
#parse(&block) ⇒ Object
11 12 13 14 15 |
# File 'lib/mr_mongo/dsl.rb', line 11 def parse(&block) instance_eval &block self end |
#set(key, value = true) ⇒ Object
17 18 19 |
# File 'lib/mr_mongo/dsl.rb', line 17 def set(key, value = true) @map_reduce.send("#{key}=", value) end |