Class: PivotalTrackerCli::StringUtilities

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

Class Method Summary collapse

Class Method Details

.colorize_status(story_state) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/string_utilities.rb', line 12

def self.colorize_status(story_state)
  case story_state
    when 'rejected'
      return story_state.red
    when 'accepted'
      return story_state.green
    when 'delivered'
      return story_state.cyan
    when 'finished'
      return story_state.yellow
    when 'started'
      return story_state.magenta
    when 'unstarted'
      return story_state
  end

  story_state
end

.embiggen_string(string) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/string_utilities.rb', line 4

def self.embiggen_string(string)
  return string if ENV['DISABLE_MARKDOWN'] == 'true'

  string
      .gsub(/(\*\*)(.*?)(\*\*)/, "\033[1m" + '\2' "\033[0m")
      .gsub(/(_)(.*?)(_)/, "\033[4m" + '\2' "\033[0m")
end