Sha256: e3108c80984821f708c4baff033eb748f695dde60057bc3743dedc7830498506

Contents?: true

Size: 328 Bytes

Versions: 4

Compression:

Stored size: 328 Bytes

Contents

module PGit
  class CurrentBranch
    def initialize
      @branches = `git branch`

      raise @branches unless current.any?
    end

    def name
      current.first.gsub(/\*\s*/, '')
    end

    def story_id
      name.scan(/\d+$/).first
    end

    private

    def current
      @branches.scan(/\*.+/)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pgit-1.0.0 lib/pgit/current_branch.rb
pgit-0.0.4 lib/pgit/current_branch.rb
pgit-0.0.3 lib/pgit/current_branch.rb
pgit-0.0.2 lib/pgit/current_branch.rb