Sha256: 9a5357c41c0aa5ded0f8b2222105f255192ba3f0d9a0a388f16bed4ac9862651

Contents?: true

Size: 950 Bytes

Versions: 1

Compression:

Stored size: 950 Bytes

Contents

require 'mongo'
require 'virtus'
require 'fish0/version'
require 'fish0/configuration'
require 'fish0/engine'
require 'fish0/exceptions'
require 'fish0/repository'
require 'fish0/paginator'
require 'fish0/concerns/cacheable'
require 'fish0/concerns/paginatable'
require 'fish0/concerns/view_model'
require 'fish0/concerns/base'
require 'fish0/collection'
require 'fish0/model'

module Fish0
  class << self
    def mongo_reader
      Mongo::Logger.logger = mongo_config['logger'] || Rails.logger
      Mongo::Client.new(mongo_config[:hosts], mongo_config[:params])
    end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fish0-0.0.6 lib/fish0.rb