Class: Pact::Provider::Help::ConsoleText::ColorizeMarkdown

Inherits:
Object
  • Object
show all
Defined in:
lib/pact/provider/help/console_text.rb

Class Method Summary collapse

Class Method Details

.call(markdown) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/pact/provider/help/console_text.rb', line 52

def self.call markdown
  markdown.split("\n").collect do | line |
    if line.start_with?("# ")
      yellow_underling line.gsub(/^# /, '')
    elsif line.start_with?("* ")
      green("* ") + line.gsub(/^\* /, '')
    else
      line
    end
  end.join("\n")
end

.green(string) ⇒ Object



68
69
70
# File 'lib/pact/provider/help/console_text.rb', line 68

def self.green string
  Rainbow(string).green
end

.yellow_underling(string) ⇒ Object



64
65
66
# File 'lib/pact/provider/help/console_text.rb', line 64

def self.yellow_underling string
  Rainbow(string).yellow.underline
end