Class: Euler::ConfigOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/euler.rb

Overview

This class holds the Euler module’s configuration.

Instance Method Summary collapse

Constructor Details

#initializeConfigOptions

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