Method: BSON::Code#initialize
- Defined in:
- lib/jmongo/mongo/bson.rb
#initialize(code, scope = {}) ⇒ Code
Wrap code to be evaluated by MongoDB.
69 70 71 72 73 74 |
# File 'lib/jmongo/mongo/bson.rb', line 69 def initialize(code, scope={}) unless code.is_a?(String) raise ArgumentError, "BSON::Code must be in the form of a String; #{code.class} is not accepted." end @bson_code = BsonCode.new(code, scope.to_bson) end |