Sha256: 41eec46a2a34ee7450bb2166ffdcecc884d05d98316387ffd3980a2e0768d108

Contents?: true

Size: 534 Bytes

Versions: 49

Compression:

Stored size: 534 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
          $stdin.noecho(&:gets)
        end
      end

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

Version data entries

49 entries across 49 versions & 2 rubygems

Version Path
bundler-1.8.9 lib/bundler/vendor/thor/line_editor/basic.rb
bundler-1.8.8 lib/bundler/vendor/thor/line_editor/basic.rb
bundler-1.7.15 lib/bundler/vendor/thor/line_editor/basic.rb
bundler-1.8.7 lib/bundler/vendor/thor/line_editor/basic.rb
bundler-1.8.6 lib/bundler/vendor/thor/line_editor/basic.rb
bundler-1.7.14 lib/bundler/vendor/thor/line_editor/basic.rb
bundler-1.8.5 lib/bundler/vendor/thor/line_editor/basic.rb
bundler-1.8.4 lib/bundler/vendor/thor/line_editor/basic.rb
bundler-1.8.3 lib/bundler/vendor/thor/line_editor/basic.rb
bundler-1.8.2 lib/bundler/vendor/thor/line_editor/basic.rb
bundler-1.8.1 lib/bundler/vendor/thor/line_editor/basic.rb
bundler-1.8.0 lib/bundler/vendor/thor/line_editor/basic.rb
bundler-1.7.13 lib/bundler/vendor/thor/line_editor/basic.rb
bundler-1.8.0.pre lib/bundler/vendor/thor/line_editor/basic.rb
bundler-1.7.12 lib/bundler/vendor/thor/line_editor/basic.rb
bundler-1.7.11 lib/bundler/vendor/thor/line_editor/basic.rb
bundler-1.7.10 lib/bundler/vendor/thor/line_editor/basic.rb
bundler-1.7.9 lib/bundler/vendor/thor/line_editor/basic.rb
bundler-1.7.8 lib/bundler/vendor/thor/line_editor/basic.rb
bundler-1.7.7 lib/bundler/vendor/thor/line_editor/basic.rb