module Sinatra::Monk

Public Instance Methods

hmonk(name:'monk', user:'', pass:'', database:'local', host:'localhost', port:27017, opts:{:connect => false}) click to toggle source

(Ruby 2.x) A helper that create a MHash instance. @param name [String] name of the used/created collection, @param user [String] the database username, @param pass [String] the password of the previous database user, @param database [String] the name of the database, @param host [String] the host of the database, @param port [Fixnum] the port to connect to the database, @param opts [Hash] monk options (set :save to autosave after each change) @return [MHash] the Monk instance.

# File lib/sinatra-monk/2.0.rb, line 94
def hmonk(name:'monk', user:'', pass:'', database:'local', host:'localhost',
          port:27017, opts:{:connect => false})
  return MHash.new(name, user, pass, database, host, port, opts)
end
monk(user:'', pass:'', database:'local', host:'localhost', port:27017, opts:{:connect => false}) click to toggle source

(Ruby 2.x) A helper that create a MBase instance. @param user [String] the database username, @param pass [String] the password of the previous database user, @param database [String] the name of the database, @param host [String] the host of the database, @param port [Fixnum] the port to connect to the database, @param opts [Hash] monk options (set :conect to autoconnect the Monk) @return [MBase] the Monk instance.

# File lib/sinatra-monk/2.0.rb, line 80
def monk(user:'', pass:'', database:'local', host:'localhost',
         port:27017, opts:{:connect => false})
  return MBase.new(user, pass, database, host, port, opts)
end