Sha256: 1de50ae3bfe840da53c0d980c43a33c777d4dfa8f610c74d7b7bafbf44679e9a

Contents?: true

Size: 846 Bytes

Versions: 3

Compression:

Stored size: 846 Bytes

Contents

module SlackRubyBotServer
  module Config
    extend self

    attr_accessor :server_class
    attr_accessor :database_adapter

    def reset!
      self.server_class = SlackRubyBotServer::Server
      self.database_adapter = if defined?(::Mongoid)
                                :mongoid
                              elsif defined?(::ActiveRecord)
                                :activerecord
                              else
                                raise 'One of "mongoid" or "activerecord" is required.'
                              end
    end

    def activerecord?
      database_adapter == :activerecord
    end

    def mongoid?
      database_adapter == :mongoid
    end

    reset!
  end

  class << self
    def configure
      block_given? ? yield(Config) : Config
    end

    def config
      Config
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
slack-ruby-bot-server-0.9.0 lib/slack-ruby-bot-server/config.rb
slack-ruby-bot-server-0.6.1 lib/slack-ruby-bot-server/config.rb
slack-ruby-bot-server-0.6.0 lib/slack-ruby-bot-server/config.rb