Sha256: 6a07d2298a2d42ad09ef7c55f59f5b7b9e08bf7b3ee0ed934eea996ebe57f4b2

Contents?: true

Size: 487 Bytes

Versions: 15

Compression:

Stored size: 487 Bytes

Contents

module Configuration

  def configuration
    yield self
  end

  def define_setting(name, default = nil)
    class_variable_set("@@#{name}", default)

    define_class_method "#{name}=" do |value|
      class_variable_set("@@#{name}", value)
    end

    define_class_method name do
      class_variable_get("@@#{name}")
    end
  end

  private

  def define_class_method(name, &block)
    (class << self; self; end).instance_eval do
      define_method name, &block
    end
  end
end

Version data entries

15 entries across 15 versions & 3 rubygems

Version Path
request_throttler-0.0.1 lib/helpers/configuration.rb
ransack_advanced_search-0.1.8 lib/ransack_advanced_search/helpers/configuration.rb
ransack_advanced_search-0.1.7 lib/ransack_advanced_search/helpers/configuration.rb
ransack_advanced_search-0.1.6 lib/ransack_advanced_search/helpers/configuration.rb
ransack_advanced_search-0.1.5 lib/ransack_advanced_search/helpers/configuration.rb
ransack_advanced_search-0.1.4 lib/ransack_advanced_search/helpers/configuration.rb
ransack_advanced_search-0.1.3 lib/ransack_advanced_search/helpers/configuration.rb
ransack_advanced_search-0.1.2 lib/ransack_advanced_search/helpers/configuration.rb
route_downcaser-1.1.4 lib/configuration.rb
route_downcaser-1.1.3 lib/configuration.rb
route_downcaser-1.1.2 lib/configuration.rb
route_downcaser-1.1.1 lib/configuration.rb
route_downcaser-1.1.0 lib/configuration.rb
route_downcaser-1.0.1 lib/configuration.rb
route_downcaser-0.2.2 lib/configuration.rb