require 'English'

module GitTracker
  module Branch
    def self.story_number
      current[/#?(?<number>\d+)/, :number]
    end

    def self.current
      branch_path = `git symbolic-ref HEAD`

      abort unless $CHILD_STATUS.exitstatus == 0

      branch_path[%r{refs/heads/(?<name>.+)}, :name] || ''
    end
  end
end

require 'English'

module GitTracker
  module Branch
    def self.story_number
      current[/#?(?<number>\d+)/, :number]
    end

    def self.current
      branch_path = `git symbolic-ref HEAD`

      abort unless exit_successful?

      branch_path[%r{refs/heads/(?<name>.+)}, :name] || ''
    end

    private

    def self.exit_successful?
      $CHILD_STATUS.exitstatus == 0
    end
  end
end

Refactor to a named method, for sanity
Refactor to a named method, for sanity
