class MrMongo::Application
Constants
- DEFAULT_URI
Public Instance Methods
exec(*files)
click to toggle source
# File lib/mr_mongo/application.rb, line 13 def exec(*files) files.each do |file| puts "Executing #{file}..." pp loader.load(file).exec puts end puts "Finished MapReduce execution." end
exec_on_memory(*files)
click to toggle source
# File lib/mr_mongo/application.rb, line 26 def exec_on_memory(*files) files.each do |file| puts "Executing #{file} on memory..." pp loader.load(file).exec_on_memory puts end puts "Finished MapReduce execution (on memory)." end
Private Instance Methods
context()
click to toggle source
# File lib/mr_mongo/application.rb, line 41 def context context_params = {db: database} context_params[:params] = ::MultiJson.load(options[:params]) if options[:params] Context.new(context_params) end
database()
click to toggle source
# File lib/mr_mongo/application.rb, line 48 def database path = URI.parse(options[:db]).path database_name = if path =~ %r{^/([^/]+)} $1 else 'test' end ::Mongo::MongoClient.from_uri(options[:db]).db(database_name) end
loader()
click to toggle source
# File lib/mr_mongo/application.rb, line 37 def loader Loader.new(context) end