Class: GitLeadTime::LeadTimeCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/git_lead_time/lead_time_command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#branchObject (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

#outputObject (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

#runObject



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