Sha256: a4b0462e3559216499cae764ce85b77496ee882e528503c3f95e98dd421c0013

Contents?: true

Size: 595 Bytes

Versions: 7

Compression:

Stored size: 595 Bytes

Contents

# frozen_string_literal: true

require_relative './base'

module Treeish
  class Branch < Base
    private

    def recents_command
      'git branch --sort=-committerdate'
    end

    def reject_strategy(line, _)
      # 'HEAD detached' means the last commit is detached from its HEAD.
      # We don't need this information and remove it.
      line =~ /HEAD detached/
    end

    def value_strategy(line, _)
      line.sub('*', '').strip
    end

    def name_strategy(line, _)
      if line.match(/\*\s/)
        line.strip
      else
        "  #{line.strip}"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gnav-0.6.4 lib/treeish/branch.rb
gnav-0.6.3 lib/treeish/branch.rb
gnav-0.6.2 lib/treeish/branch.rb
gnav-0.6.1 lib/treeish/branch.rb
gnav-0.6.0 lib/treeish/branch.rb
gnav-0.5.2 lib/treeish/branch.rb
gnav-0.5.0 lib/treeish/branch.rb