Methods

AppConfig::Storage::Mongo

Mongo storage method.

Constants

DEFAULTS

Public Class Methods

new(options) click to toggle source
# File lib/app_config/storage/mongo.rb, line 18
def initialize(options)
  # Allows passing `true` as an option.
  if options.is_a?(Hash)
    @options = DEFAULTS.merge(options)
  else
    @options = DEFAULTS
  end

  setup_connection!
  fetch_data!
end

Public Instance Methods

save!() click to toggle source

Saves the data back to Mongo. Returns `true`/`false`.

# File lib/app_config/storage/mongo.rb, line 31
def save!
  if @_id
    retval = collection.update({ '_id' => @_id}, @data.to_hash)
  else
    retval = collection.save(@data.to_hash)
  end

  !!retval
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.