Module: Wirb::Colorizer

Defined in:
lib/wirb/colorizer.rb

Defined Under Namespace

Modules: HighLine, Paint, Wirb0, Wirb0_HighLine, Wirb0_Paint, Wirble

Class Method Summary collapse

Class Method Details

.const_missing(colorizer) ⇒ Object

Raises:

  • (LoadError)


11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/wirb/colorizer.rb', line 11

def const_missing(colorizer)
  path = File.dirname(__FILE__) + '/colorizer/' + colorizer.to_s.downcase

  begin
    require path
  rescue LoadError => e
    raise LoadError, "Could not load colorizer #{colorizer} at #{path}: #{e}"
  end
  
  raise LoadError, "Colorizer definition at #{path} does not appear to define #{self}::#{colorizer}" \
    unless const_defined?(colorizer)
  const_get colorizer
end