Module: Fish0

Defined in:
lib/fish0.rb,
lib/fish0/model.rb,
lib/fish0/engine.rb,
lib/fish0/version.rb,
lib/fish0/paginator.rb,
lib/fish0/collection.rb,
lib/fish0/exceptions.rb,
lib/fish0/repository.rb,
lib/fish0/concerns/base.rb,
lib/fish0/configuration.rb,
lib/fish0/concerns/cacheable.rb,
lib/fish0/concerns/equalable.rb,
lib/fish0/concerns/view_model.rb,
lib/fish0/concerns/paginatable.rb

Defined Under Namespace

Modules: Concerns Classes: Collection, Configuration, Engine, Model, Paginator, RecordNotFound, Repository

Constant Summary collapse

VERSION =
'0.2.0'.freeze

Class Method Summary collapse

Class Method Details

.mongo_configObject



24
25
26
27
28
29
30
31
# File 'lib/fish0.rb', line 24

def mongo_config
  if File.file?(File.expand_path('../config/mongo.yml', __FILE__))
    config = Rails.application.config_for(:mongo)
    Configuration.mongo_uri = config['mongo_uri']
    Configuration.mongo_params = config['params']
  end
  @mongo_config || { mongo_uri: Configuration.mongo_uri, params: Configuration.mongo_params }
end

.mongo_readerObject



19
20
21
22
# File 'lib/fish0.rb', line 19

def mongo_reader
  Mongo::Logger.logger = mongo_config['logger'] || Rails.logger
  @mongo_reader ||= Mongo::Client.new(mongo_config[:mongo_uri], mongo_config[:params])
end