Class: Hanami::Config::FrameworkConfiguration Private

Inherits:
BasicObject
Defined in:
lib/hanami/config/framework_configuration.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Collects all the settings for a given framework configuration and then forwards them when the application is loaded.

Since:

  • 0.2.0

Instance Method Summary collapse

Constructor Details

#initialize(&blk) ⇒ FrameworkConfiguration

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of FrameworkConfiguration

Since:

  • 0.2.0



12
13
14
15
# File 'lib/hanami/config/framework_configuration.rb', line 12

def initialize(&blk)
  @blocks   = [blk || ::Proc.new { }]
  @settings = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &blk) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.2.0



38
39
40
# File 'lib/hanami/config/framework_configuration.rb', line 38

def method_missing(m, *args, &blk)
  @settings.push([m, args, blk])
end

Instance Method Details

#__add(&blk) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.6.0



31
32
33
34
# File 'lib/hanami/config/framework_configuration.rb', line 31

def __add(&blk)
  @blocks << blk
  self
end

#__apply(configuration) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 0.2.0



19
20
21
22
23
24
25
26
27
# File 'lib/hanami/config/framework_configuration.rb', line 19

def __apply(configuration)
  @blocks.compact.each do |blk|
    configuration.instance_eval(&blk)
  end

  @settings.each do |(m, args, blk)|
    configuration.public_send(m, *args, &blk)
  end
end