Class: CommitRange

Inherits:
Struct
  • Object
show all
Defined in:
lib/git_fame/commit_range.rb

Constant Summary collapse

SHORT_LENGTH =
7

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#current_branchObject

Returns the value of attribute current_branch

Returns:

  • (Object)

    the current value of current_branch



1
2
3
# File 'lib/git_fame/commit_range.rb', line 1

def current_branch
  @current_branch
end

#dataObject

Returns the value of attribute data

Returns:

  • (Object)

    the current value of data



1
2
3
# File 'lib/git_fame/commit_range.rb', line 1

def data
  @data
end

Instance Method Details

#is_range?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/git_fame/commit_range.rb', line 10

def is_range?
  data.is_a?(Array)
end

#rangeObject



14
15
16
# File 'lib/git_fame/commit_range.rb', line 14

def range
  is_range? ? data : [data]
end

#to_s(short = false) ⇒ Object



4
5
6
7
8
# File 'lib/git_fame/commit_range.rb', line 4

def to_s(short = false)
  @_to_s ||= range.map do |commit|
    short ? shorten(commit) : commit
  end.join("..")
end