Module: Configify::ClassMethods

Defined in:
lib/configify.rb

Instance Method Summary collapse

Instance Method Details

#configuration(&block) ⇒ Object



10
11
12
13
14
# File 'lib/configify.rb', line 10

def configuration &block
  @configuration_class = Class.new Base, &block if block_given?

  @configuration_class
end

#with_config {|new_config| ... } ⇒ Object

Yields:

  • (new_config)


16
17
18
19
20
21
22
23
# File 'lib/configify.rb', line 16

def with_config
  return unless configuration

  new_config = configuration.new
  yield new_config if block_given?

  new config: new_config
end