Class: Statistrano::Config

Inherits:
Object
  • Object
show all
Includes:
RakeTaskWithContextCreation
Defined in:
lib/statistrano/config.rb,
lib/statistrano/config/configurable.rb,
lib/statistrano/config/rake_task_with_context_creation.rb

Defined Under Namespace

Modules: Configurable, RakeTaskWithContextCreation Classes: ValidationError

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from RakeTaskWithContextCreation

included, #namespace, #task

Constructor Details

#initialize(options: nil, tasks: nil, validators: nil) ⇒ Config

initalize with the potential for seed options this is required so that when config’d classes are extended we can pass that configuration along



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/statistrano/config.rb', line 15

def initialize options: nil, tasks: nil, validators: nil
  @options    = options.nil?    ? {} : options.clone
  @tasks      = tasks.nil?      ? {} : tasks.clone
  @validators = validators.nil? ? {} : validators.clone

  @options.each do |key,val|
    define_option_accessor key.to_sym
  end

  @validators.each do |key,val|
    define_validator key.to_sym
  end
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



8
9
10
# File 'lib/statistrano/config.rb', line 8

def options
  @options
end

#tasksObject (readonly)

Returns the value of attribute tasks.



8
9
10
# File 'lib/statistrano/config.rb', line 8

def tasks
  @tasks
end

#validatorsObject (readonly)

Returns the value of attribute validators.



8
9
10
# File 'lib/statistrano/config.rb', line 8

def validators
  @validators
end