Sha256: d5dd02e5e7db9bd0eda4e8c3e6798bc1a77e9ae92cf6481228ccca799c7cbc25

Contents?: true

Size: 654 Bytes

Versions: 43

Compression:

Stored size: 654 Bytes

Contents

class Thor
  module LineEditor
    class Basic
      attr_reader :prompt, :options

      def self.available?
        true
      end

      def initialize(prompt, options)
        @prompt = prompt
        @options = options
      end

      def readline
        $stdout.print(prompt)
        get_input
      end

    private

      def get_input
        if echo?
          $stdin.gets
        else
          # Lazy-load io/console since it is gem-ified as of 2.3
          require "io/console" if RUBY_VERSION > "1.9.2"
          $stdin.noecho(&:gets)
        end
      end

      def echo?
        options.fetch(:echo, true)
      end
    end
  end
end

Version data entries

43 entries across 43 versions & 14 rubygems

Version Path
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor/line_editor/basic.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/thor-0.20.3/lib/thor/line_editor/basic.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/thor-0.20.3/lib/thor/line_editor/basic.rb
tdiary-5.1.0 vendor/bundle/gems/thor-0.20.3/lib/thor/line_editor/basic.rb
spec_fill-0.1.2 vendor/bundle/ruby/2.6.0/gems/thor-0.20.3/lib/thor/line_editor/basic.rb
spec_fill-0.1.1 vendor/bundle/ruby/2.6.0/gems/thor-0.20.3/lib/thor/line_editor/basic.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/thor-0.20.3/lib/thor/line_editor/basic.rb
spec_fill-0.1.0 vendor/bundle/ruby/2.6.0/gems/thor-0.20.3/lib/thor/line_editor/basic.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor/line_editor/basic.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor/line_editor/basic.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/thor-0.20.3/lib/thor/line_editor/basic.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/thor-0.20.3/lib/thor/line_editor/basic.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/thor-0.20.3/lib/thor/line_editor/basic.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/thor-0.20.3/lib/thor/line_editor/basic.rb
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/thor-0.20.3/lib/thor/line_editor/basic.rb
zuora_connect_ui-0.8.0 vendor/ruby/2.6.0/gems/thor-0.20.3/lib/thor/line_editor/basic.rb
spiral_form-0.1.1 vendor/bundle/gems/thor-0.20.3/lib/thor/line_editor/basic.rb
spiral_form-0.1.0 vendor/bundle/gems/thor-0.20.3/lib/thor/line_editor/basic.rb
zuora_connect_ui-0.7.1 vendor/ruby/2.6.0/gems/thor-0.20.3/lib/thor/line_editor/basic.rb
zuora_connect_ui-0.7.0 vendor/ruby/2.6.0/gems/thor-0.20.3/lib/thor/line_editor/basic.rb