class GitPrepareBranch::Styles

Attributes

styler[R]

Public Class Methods

new(styler: nil) click to toggle source
# File lib/git-prepare-branch/styles.rb, line 5
def initialize(styler: nil)
  @styler = styler || Rainbow.global.method(:wrap)
end

Public Instance Methods

apply(text, style = :default) click to toggle source
# File lib/git-prepare-branch/styles.rb, line 9
def apply(text, style = :default)
  return text if style == :default
  send(style, text)
end
bold(text) click to toggle source
# File lib/git-prepare-branch/styles.rb, line 14
def bold(text)
  style(text).bright
end
header(text) click to toggle source
# File lib/git-prepare-branch/styles.rb, line 22
def header(text)
  style(text).color(:white).bg(:darkslateblue)
end
header_ok(text) click to toggle source
# File lib/git-prepare-branch/styles.rb, line 26
def header_ok(text)
  style(text).color(:white).bg(:darkgreen)
end
header_warning(text) click to toggle source
# File lib/git-prepare-branch/styles.rb, line 30
def header_warning(text)
  style(text).color(:white).bg(:red)
end
hint(text) click to toggle source
# File lib/git-prepare-branch/styles.rb, line 34
def hint(text)
  style(text).color(:dimgray)
end
hr(text)
Alias for: footer

Private Instance Methods

style(text) click to toggle source
# File lib/git-prepare-branch/styles.rb, line 44
def style(text)
  styler.call(text)
end