Sha256: dd5f94a29504279f1c99dac87a0911c237d3edc7932447d254d87bd7a12480d4

Contents?: true

Size: 481 Bytes

Versions: 11

Compression:

Stored size: 481 Bytes

Contents

module Cp8Cli
  class BranchName
    SEPARATOR = "/"

    def initialize(user:, story:)
      @user = user
      @story = story
    end

    def to_s
      "#{prefix}#{user_input}"
    end

    private

      attr_reader :user, :story

      def user_input
        Command.ask("Branch name: #{prefix}", default: default)
      end

      def prefix
        user.initials.downcase + SEPARATOR
      end

      def default
        story.title.parameterize[0..50]
      end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
cp8_cli-9.1.1 lib/cp8_cli/branch_name.rb
cp8_cli-9.1.0 lib/cp8_cli/branch_name.rb
cp8_cli-9.0.3 lib/cp8_cli/branch_name.rb
cp8_cli-9.0.2 lib/cp8_cli/branch_name.rb
cp8_cli-9.0.1 lib/cp8_cli/branch_name.rb
cp8_cli-9.0.0 lib/cp8_cli/branch_name.rb
cp8_cli-8.2.1 lib/cp8_cli/branch_name.rb
cp8_cli-8.2.0 lib/cp8_cli/branch_name.rb
cp8_cli-8.1.0 lib/cp8_cli/branch_name.rb
cp8_cli-8.0.1 lib/cp8_cli/branch_name.rb
cp8_cli-8.0.0 lib/cp8_cli/branch_name.rb