Class: Configure
- Inherits:
-
Object
- Object
- Configure
- Defined in:
- lib/wherever/configure.rb
Instance Attribute Summary collapse
-
#_id ⇒ Object
Returns the value of attribute _id.
-
#key_groups ⇒ Object
Returns the value of attribute key_groups.
-
#keys ⇒ Object
Returns the value of attribute keys.
Instance Method Summary collapse
-
#initialize(options) ⇒ Configure
constructor
A new instance of Configure.
Constructor Details
#initialize(options) ⇒ Configure
Returns a new instance of Configure.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/wherever/configure.rb', line 3 def initialize() host = ["host"] || 'localhost' database = ["database"] || 'wherever' user = ["user"] password = ["password"] @_id = ["key"] ||= "unqiue_id" Mongoid.config do |config| mongo_connection = Mongo::Connection.new(host).db(database) mongo_connection.authenticate(user, password) if user config.master = mongo_connection end @keys = StringHelper.add_method_to_id(["keys"], false) @key_groups = StringHelper.add_method_to_id(["key_groups"] || ["keys"]) end |
Instance Attribute Details
#_id ⇒ Object
Returns the value of attribute _id.
2 3 4 |
# File 'lib/wherever/configure.rb', line 2 def _id @_id end |
#key_groups ⇒ Object
Returns the value of attribute key_groups.
2 3 4 |
# File 'lib/wherever/configure.rb', line 2 def key_groups @key_groups end |
#keys ⇒ Object
Returns the value of attribute keys.
2 3 4 |
# File 'lib/wherever/configure.rb', line 2 def keys @keys end |