Sha256: 8a3fe5b7f27d82fc5bf459edfcc5137c57ed8110458049fbd85038f3cd5b8ed7

Contents?: true

Size: 580 Bytes

Versions: 1

Compression:

Stored size: 580 Bytes

Contents

require 'highline/import'

module Stevenson
  module Input
    class Text
      include Input::Base

      def initialize(options)
        super

        # Save the basic settings for the prompt
        @prompt = options['prompt'] || ''
        @limit = options['limit'] || false
      end

      def collect!
        # Ask the user the question and apply the appropriate options
        answer = ask(@prompt) do |q|
          q.default = default
          q.limit = @limit if @limit
        end

        # Return the user's answer
        answer.to_s
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stevenson-1.0.1 lib/stevenson/input/text.rb