Sha256: cb873b26387c2b0faf74657628c76ce3aad1803ad2b6b97f8d2ee58844f0aa50

Contents?: true

Size: 954 Bytes

Versions: 1

Compression:

Stored size: 954 Bytes

Contents

# frozen_string_literal: true

module Helium
  class Console
    class Prompt
      def initialize
        @line = 0
      end

      def pry_prompt
        Pry::Prompt.new(
          'helium',
          'Default prompt for helium',
          [
            method(:active_prompt),
            method(:wait_prompt)
          ]
        )
      end

      private

      def active_prompt(context, _nesting, _pry)
        @line += 1
        str = [
          ColorizedString.new("[#{@line}]").light_black,
          ColorizedString.new("He\u269B").light_blue,
          ColorizedString.new("(#{context.inspect})").magenta
        ].join(' ')
        "#{str}> "
      end

      def wait_prompt(context, _nesting, _pry)
        @line += 1
        str = [
          ColorizedString.new("[#{@line}]").light_black,
          '   ',
          ColorizedString.new("(#{context.inspect})").magenta
        ].join(' ')
        "#{str}> "
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
helium-console-0.1.13 lib/helium/console/prompt.rb