Class: Surveyor::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/surveyor/config.rb

Overview

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

Constant Summary collapse

@@config_hash =
{}

Class Method Summary collapse

Class Method Details

.[](key) ⇒ Object



28
29
30
# File 'lib/surveyor/config.rb', line 28

def [](key)
  @@config_hash[key]
end

.[]=(key, value) ⇒ Object



32
33
34
# File 'lib/surveyor/config.rb', line 32

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

.run {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



40
41
42
# File 'lib/surveyor/config.rb', line 40

def run
  yield self if block_given?
end

.to_hashObject



36
37
38
# File 'lib/surveyor/config.rb', line 36

def to_hash
  @@config_hash
end