Class: GitLeft::BranchReporter
- Inherits:
-
Object
- Object
- GitLeft::BranchReporter
- Defined in:
- lib/git_left/branch_reporter.rb
Instance Method Summary collapse
- #branch_info ⇒ Object
- #green(text) ⇒ Object
-
#initialize(branch) ⇒ BranchReporter
constructor
A new instance of BranchReporter.
- #instructions ⇒ Object
- #report ⇒ Object
- #underlined(text) ⇒ Object
Constructor Details
#initialize(branch) ⇒ BranchReporter
Returns a new instance of BranchReporter.
3 4 5 |
# File 'lib/git_left/branch_reporter.rb', line 3 def initialize(branch) @branch = branch end |
Instance Method Details
#branch_info ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/git_left/branch_reporter.rb', line 12 def branch_info str = "\nDeciding time: #{underlined(@branch.name)}" if @branch.is_upstream? str << green(" (exists upstream)") end str end |
#green(text) ⇒ Object
30 31 32 |
# File 'lib/git_left/branch_reporter.rb', line 30 def green(text) "\e[32m#{text}\e[0m" end |
#instructions ⇒ Object
22 23 24 |
# File 'lib/git_left/branch_reporter.rb', line 22 def instructions "(h to delete, l to skip, anything else to quit)\n" end |
#report ⇒ Object
7 8 9 10 |
# File 'lib/git_left/branch_reporter.rb', line 7 def report puts branch_info puts instructions end |
#underlined(text) ⇒ Object
26 27 28 |
# File 'lib/git_left/branch_reporter.rb', line 26 def underlined(text) "\e[4m" << text << "\e[24m" end |