Class: LightConfig::Builder
- Inherits:
-
Object
- Object
- LightConfig::Builder
- Defined in:
- lib/light_config.rb
Instance Method Summary collapse
-
#initialize(configuration) ⇒ Builder
constructor
A new instance of Builder.
- #method_missing(method, *args, &block) ⇒ Object
Constructor Details
#initialize(configuration) ⇒ Builder
Returns a new instance of Builder.
22 23 24 |
# File 'lib/light_config.rb', line 22 def initialize(configuration) @configuration = configuration end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/light_config.rb', line 26 def method_missing(method, *args, &block) raise ArgumentError("wrong number of arguments(#{args.length} for 1)") unless args.length < 2 value = if block then ::LightConfig::Configuration.new(&block) else args.first end @configuration.instance_variable_get(:@properties)[method] = value end |