Class: String

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

Overview

Instance Method Summary collapse

Instance Method Details

#absolute_pathObject


17
18
19
# File 'lib/core_extensions.rb', line 17

def absolute_path
  sub '~', Dir.home
end

#colorize(color_code) ⇒ Object


3
4
5
# File 'lib/core_extensions.rb', line 3

def colorize(color_code)
  "\e[#{color_code}m#{self}\e[0m"
end

#highlightedObject


7
8
9
10
# File 'lib/core_extensions.rb', line 7

def highlighted
  return self unless Punch.config.colors_enabled?
  colorize Punch.config.highlight_color_code
end

#today_colorObject


12
13
14
15
# File 'lib/core_extensions.rb', line 12

def today_color
  return self unless Punch.config.colors_enabled?
  colorize Punch.config.today_color_code
end