Class: Guts::Configuration

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

Overview

Configuration class for Guts

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object

Getter and setter method for configuration so that there is not a set amount of configs

Parameters:

  • name (String)

    the config name

  • args (Array)

    list of args (used for setting)

Returns:

  • the configuration requested



22
23
24
25
26
27
28
29
30
# File 'lib/guts/configuration.rb', line 22

def method_missing(name, *args)
  name = name.to_s

  if name =~ /=$/
    instance_variable_set "@#{name.chop}", args.first
  else
    instance_variable_get "@#{name}"
  end
end