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
comidita_ull-0.1.1 vendor/bundle/ruby/2.3.0/gems/thor-0.20.0/lib/thor/line_editor/basic.rb
comidita_ull-0.1.0 vendor/bundle/ruby/2.3.0/gems/thor-0.20.0/lib/thor/line_editor/basic.rb
thor-0.20.0 lib/thor/line_editor/basic.rb