Module: Cunfug::Configuration::ClassMethods

Defined in:
lib/cunfug/configuration.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/cunfug/configuration.rb', line 13

def method_missing(method_name, *args)
  @config ||= OpenStruct.new
  
  if method_name.to_s.match(/^.+=$/)
    @config.send(method_name, args.first)
  else
    @config.send(method_name)
  end
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



23
24
25
# File 'lib/cunfug/configuration.rb', line 23

def configure
  yield self
end