Sha256: 066f4cf8aba469169fb1a096af384360a259e373bd58e57bbea81934c3437439

Contents?: true

Size: 296 Bytes

Versions: 1

Compression:

Stored size: 296 Bytes

Contents

module UserInput
  ##
  # Helper class for asking yes/no questions
  class Boolean < Prompt
    def initialize(params = {})
      super
      @validation = /(y|yes|n|no)/i
      @separator = ' [y/n]?' if @separator == '?'
    end

    def ask
      super =~ /y/i ? true : false
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
userinput-1.0.2 lib/userinput/boolean.rb