Class: Colors

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

Overview

passes the colors to the terminal

Instance Method Summary collapse

Constructor Details

#initializeColors

Returns a new instance of Colors.



31
32
33
# File 'lib/challenges.rb', line 31

def initialize
  @pastel = Pastel.new
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/challenges.rb', line 39

def method_missing(name, *args)
  if respond_to_missing?(name)
    @pastel.send(name, *args)
  else
    @pastel.send(:white, *args)
  end
end

Instance Method Details

#respond_to_missing?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/challenges.rb', line 35

def respond_to_missing?(name, include_private = false)
  !name.to_s.empty? || super
end