Sha256: 584f0ce4f49314b44d9e79b5cf0a77a20b41e4b83c600172de244fd072d72deb
Contents?: true
Size: 454 Bytes
Versions: 9
Compression:
Stored size: 454 Bytes
Contents
class CommitRange < Struct.new(:data, :current_branch) SHORT_LENGTH = 7 def to_s(short = false) @_to_s ||= range.map do |commit| short ? shorten(commit) : commit end.join("..") end def is_range? data.is_a?(Array) end def range is_range? ? data : [data] end private def branch?(commit) current_branch == commit end def shorten(commit) branch?(commit) ? commit : commit[0..SHORT_LENGTH] end end
Version data entries
9 entries across 9 versions & 1 rubygems