Sha256: c2c1a12d5a5c48dbe99d367a061875da4aa859d9f15ddbc7fcf300b92309f266

Contents?: true

Size: 1.1 KB

Versions: 33

Compression:

Stored size: 1.1 KB

Contents

module Surveyor
  #
  # The Surveyor::Config object emulates a hash with simple bracket methods
  # which allow you to get and set values in the configuration table:
  #
  #   Surveyor::Config['setting.name'] = 'value'
  #   Surveyor::Config['setting.name'] #=> "value"
  #
  # Currently, there is not a way to edit configuration through the admin
  # system so it must be done manually. The console script is probably the
  # easiest way to this:
  #
  #   % script/console production
  #   Loading production environment.
  #   >> Surveyor::Config['setting.name'] = 'value'
  #   => "value"
  #   >>
  #
  # Surveyor currently uses the following settings:
  #
  # defaults.title               :: the title of the survey system
  # defaults.layout              :: the layout used by the survey system

  class Config
    @@config_hash = {}

    class << self
      def [](key)
        @@config_hash[key]
      end

      def []=(key, value)
        @@config_hash[key] = value
      end

      def to_hash
        @@config_hash
      end
      
      def run
        yield self if block_given?
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 3 rubygems

Version Path
ccls-surveyor-1.0.0 lib/surveyor/config.rb
jakewendt-surveyor-0.11.3 lib/surveyor/config.rb
surveyor-0.14.2 lib/surveyor/config.rb
surveyor-0.14.1 lib/surveyor/config.rb
surveyor-0.14.0 lib/surveyor/config.rb
surveyor-0.13.0 lib/surveyor/config.rb
surveyor-0.12.1 lib/surveyor/config.rb
surveyor-0.11.0 lib/surveyor/config.rb
surveyor-0.10.0 lib/surveyor/config.rb
surveyor-0.9.10 lib/surveyor/config.rb
surveyor-0.9.9 lib/surveyor/config.rb
surveyor-0.9.8 lib/surveyor/config.rb
surveyor-0.9.7 lib/surveyor/config.rb
surveyor-0.9.6 lib/surveyor/config.rb
surveyor-0.9.5 lib/surveyor/config.rb
surveyor-0.9.4 lib/surveyor/config.rb
surveyor-0.9.3 lib/surveyor/config.rb
surveyor-0.9.2 lib/surveyor/config.rb
surveyor-0.9.1 lib/surveyor/config.rb
surveyor-0.9.0 lib/surveyor/config.rb