Class: GitPrepareBranch::Styles

Inherits:
Object
  • Object
show all
Defined in:
lib/git-prepare-branch/styles.rb

Instance Method Summary collapse

Constructor Details

#initialize(styler: nil) ⇒ Styles

Returns a new instance of Styles.



5
6
7
# File 'lib/git-prepare-branch/styles.rb', line 5

def initialize(styler: nil)
  @styler = styler || Rainbow.global.method(:wrap)
end

Instance Method Details

#apply(text, style = :default) ⇒ Object



9
10
11
12
# 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) ⇒ Object



14
15
16
# File 'lib/git-prepare-branch/styles.rb', line 14

def bold(text)
  style(text).bright
end


18
19
20
# File 'lib/git-prepare-branch/styles.rb', line 18

def footer(text)
  style(text).color(:dimgray)
end

#header(text) ⇒ Object



22
23
24
# File 'lib/git-prepare-branch/styles.rb', line 22

def header(text)
  style(text).color(:white).bg(:darkslateblue)
end

#header_ok(text) ⇒ Object



26
27
28
# File 'lib/git-prepare-branch/styles.rb', line 26

def header_ok(text)
  style(text).color(:white).bg(:darkgreen)
end

#header_warning(text) ⇒ Object



30
31
32
# File 'lib/git-prepare-branch/styles.rb', line 30

def header_warning(text)
  style(text).color(:white).bg(:red)
end

#hint(text) ⇒ Object



34
35
36
# File 'lib/git-prepare-branch/styles.rb', line 34

def hint(text)
  style(text).color(:dimgray)
end