Class: Euler::ConfigOptions
- Inherits:
-
Object
- Object
- Euler::ConfigOptions
- Defined in:
- lib/euler.rb
Overview
This class holds the Euler module’s configuration.
Instance Method Summary collapse
-
#initialize ⇒ ConfigOptions
constructor
Initialize an empty OpenStruct to hold configuration options.
-
#method_missing(method, *args, &block) ⇒ Object
To set a config option call the corresponding method with an argument.
Constructor Details
#initialize ⇒ ConfigOptions
Initialize an empty OpenStruct to hold configuration options
17 18 19 |
# File 'lib/euler.rb', line 17 def initialize @config = OpenStruct.new end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
To set a config option call the corresponding method with an argument. To retrieve a config option call the corresponding method without an argument.
23 24 25 26 27 28 29 |
# File 'lib/euler.rb', line 23 def method_missing method, *args, &block if args.empty? @config.send(method) else @config.send("#{method}=", args.first) end end |