Class: GitLeadTime::LeadTimeCommand
- Inherits:
-
Object
- Object
- GitLeadTime::LeadTimeCommand
- Defined in:
- lib/git_lead_time/lead_time_command.rb
Instance Attribute Summary collapse
-
#branch ⇒ Object
readonly
Returns the value of attribute branch.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
- #format_merge(merge) ⇒ Object
-
#initialize(ref = "HEAD", output: $stdout) ⇒ LeadTimeCommand
constructor
A new instance of LeadTimeCommand.
- #run ⇒ Object
Constructor Details
#initialize(ref = "HEAD", output: $stdout) ⇒ LeadTimeCommand
Returns a new instance of LeadTimeCommand.
8 9 10 11 |
# File 'lib/git_lead_time/lead_time_command.rb', line 8 def initialize(ref="HEAD", output: $stdout) @branch = Branch.new(ref) @output = output end |
Instance Attribute Details
#branch ⇒ Object (readonly)
Returns the value of attribute branch.
7 8 9 |
# File 'lib/git_lead_time/lead_time_command.rb', line 7 def branch @branch end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
7 8 9 |
# File 'lib/git_lead_time/lead_time_command.rb', line 7 def output @output end |
Instance Method Details
#format_merge(merge) ⇒ Object
21 22 23 |
# File 'lib/git_lead_time/lead_time_command.rb', line 21 def format_merge(merge) LeadTimeFormat.new(merge).to_s end |
#run ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/git_lead_time/lead_time_command.rb', line 13 def run branch.each_merge do |merge| output.puts format_merge(merge) end rescue Errno::EPIPE # Our buffer got closed by `head` or the like. end |