Module: Inkjet::Colors::String
- Defined in:
- lib/inkjet/colors.rb
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args) ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/inkjet/colors.rb', line 81 def method_missing(meth, *args) if meth.match(/\A(#{Inkjet::Colors::Colors.join("|")})(!?)\Z/) Inkjet.send("colorize#{$2}", $1, self, *args) elsif meth.match(/\A(#{Inkjet::Colors::Colors.join("|")})_(background|bg)(!?)\Z/) Inkjet.send("colorize_background#{$3}", $1, self, *args) elsif meth.match(/\A(#{Inkjet::Colors::Colors.join("|")})_(#{Inkjet::Colors::Colors.join("|")})(!?)\Z/) Inkjet.send("colorize_with_background#{$3}", $1, $2, self, *args) else super end end |