Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/midori/core_ext/string.rb,
lib/midori/env.rb
Overview
Meta-programming String for Syntactic Sugars
Instance Method Summary collapse
-
#blue ⇒ Object
color the string with blue color.
-
#colorize(color_code) ⇒ String
Colored string.
-
#development? ⇒ TrueClass | FalseClass
If string is equal to development.
-
#green ⇒ Object
color the string with green color.
-
#production? ⇒ TrueClass | FalseClass
If string is equal to production.
-
#red ⇒ Object
color the string with red color.
-
#yellow ⇒ Object
color the string with yellow color.
Instance Method Details
#blue ⇒ Object
color the string with blue color
26 27 28 |
# File 'lib/midori/core_ext/string.rb', line 26 def blue colorize(34) end |
#colorize(color_code) ⇒ String
Returns colored string.
6 7 8 |
# File 'lib/midori/core_ext/string.rb', line 6 def colorize(color_code) "\e[#{color_code}m#{self}\e[0m" end |
#development? ⇒ TrueClass | FalseClass
Returns if string is equal to development.
15 16 17 |
# File 'lib/midori/env.rb', line 15 def development? self == 'development' end |
#green ⇒ Object
color the string with green color
16 17 18 |
# File 'lib/midori/core_ext/string.rb', line 16 def green colorize(32) end |
#production? ⇒ TrueClass | FalseClass
Returns if string is equal to production.
10 11 12 |
# File 'lib/midori/env.rb', line 10 def production? self == 'production' end |
#red ⇒ Object
color the string with red color
11 12 13 |
# File 'lib/midori/core_ext/string.rb', line 11 def red colorize(31) end |
#yellow ⇒ Object
color the string with yellow color
21 22 23 |
# File 'lib/midori/core_ext/string.rb', line 21 def yellow colorize(33) end |