Sha256: 251c7889b13370cc407b74124a69e2f4dbbb7760589970e521b1ac6b9b795680

Contents?: true

Size: 875 Bytes

Versions: 9

Compression:

Stored size: 875 Bytes

Contents

module Scenic
  class Configuration
    # The Scenic database adapter instance to use when executing SQL.
    #
    # Defaults to an instance of {Adapters::Postgres}
    # @return Scenic adapter
    attr_accessor :database

    def initialize
      @database = Scenic::Adapters::Postgres.new
    end
  end

  # @return [Scenic::Configuration] Scenic's current configuration
  def self.configuration
    @configuration ||= Configuration.new
  end

  # Set Scenic's configuration
  #
  # @param config [Scenic::Configuration]
  def self.configuration=(config)
    @configuration = config
  end

  # Modify Scenic's current configuration
  #
  # @yieldparam [Scenic::Configuration] config current Scenic config
  # ```
  # Scenic.configure do |config|
  #   config.database = Scenic::Adapters::Postgres.new
  # end
  # ```
  def self.configure
    yield configuration
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
scenic-1.8.0 lib/scenic/configuration.rb
scenic-1.7.0 lib/scenic/configuration.rb
scenic-1.6.0 lib/scenic/configuration.rb
scenic-1.5.5 lib/scenic/configuration.rb
scenic-jets-1.5.5 lib/scenic/configuration.rb
scenic-jets-1.5.4 lib/scenic/configuration.rb
scenic-1.5.4 lib/scenic/configuration.rb
scenic-1.5.3 lib/scenic/configuration.rb
scenic-1.5.2 lib/scenic/configuration.rb