Module: DryStructGenerator::Config::Configuration

Included in:
GeneratorConfiguration
Defined in:
lib/dry_struct_generator/config/configuration.rb

Instance Method Summary collapse

Instance Method Details

#configuration {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



6
7
8
# File 'lib/dry_struct_generator/config/configuration.rb', line 6

def configuration
  yield self
end

#define_setting(name, default = nil) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/dry_struct_generator/config/configuration.rb', line 10

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