Class: XRayMachine::Options

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

Constant Summary collapse

COLORS =
{
  red:     "\e[31m",
  green:   "\e[32m",
  yellow:  "\e[33m",
  blue:    "\e[34m",
  magenta: "\e[35m",
  cyan:    "\e[36m"
}

Instance Method Summary collapse

Constructor Details

#initializeOptions

Returns a new instance of Options.



21
22
23
# File 'lib/x_ray_machine/config.rb', line 21

def initialize
  @streams = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, config = nil) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/x_ray_machine/config.rb', line 25

def method_missing(name, config=nil)
  name = name[0, name.size - 1] if name[name.size - 1] == "="
  name = name.to_sym

  if config
    @streams[name] = fill_defaults_for(name, config)
  else
    @streams[name] ||= fill_defaults_for(name)
  end
end