Class: GitPrepareBranch::Styles
- Inherits:
-
Object
- Object
- GitPrepareBranch::Styles
- Defined in:
- lib/git-prepare-branch/styles.rb
Instance Method Summary collapse
- #apply(text, style = :default) ⇒ Object
- #bold(text) ⇒ Object
- #footer(text) ⇒ Object (also: #hr)
- #header(text) ⇒ Object
- #header_ok(text) ⇒ Object
- #header_warning(text) ⇒ Object
- #hint(text) ⇒ Object
-
#initialize(styler: nil) ⇒ Styles
constructor
A new instance of Styles.
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 |
#footer(text) ⇒ Object Also known as: hr
18 19 20 |
# File 'lib/git-prepare-branch/styles.rb', line 18 def (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 |