Sha256: b3b4277efb2db33c77036543a53a37ba0d77517809a9a88694fd4bdd842e2a74

Contents?: true

Size: 414 Bytes

Versions: 104

Compression:

Stored size: 414 Bytes

Contents

module Terraspace::Util
  module Sure
    def sure?(message="Are you sure?", desc=nil)
      if @options[:yes]
        sure = 'y'
      else
        out = if desc
          "\n#{desc}\n#{message} (y/N) "
        else
          "#{message} (y/N) "
        end
        print out
        sure = $stdin.gets
      end

      unless sure =~ /^y/
        puts "Whew! Exiting."
        exit 0
      end
    end
  end
end

Version data entries

104 entries across 104 versions & 1 rubygems

Version Path
terraspace-2.2.17 lib/terraspace/util/sure.rb
terraspace-2.2.16 lib/terraspace/util/sure.rb
terraspace-2.2.15 lib/terraspace/util/sure.rb
terraspace-2.2.14 lib/terraspace/util/sure.rb
terraspace-2.2.13 lib/terraspace/util/sure.rb
terraspace-2.2.12 lib/terraspace/util/sure.rb
terraspace-2.2.11 lib/terraspace/util/sure.rb
terraspace-2.2.10 lib/terraspace/util/sure.rb
terraspace-2.2.9 lib/terraspace/util/sure.rb
terraspace-2.2.8 lib/terraspace/util/sure.rb
terraspace-2.2.7 lib/terraspace/util/sure.rb
terraspace-2.2.6 lib/terraspace/util/sure.rb
terraspace-2.2.5 lib/terraspace/util/sure.rb
terraspace-2.2.4 lib/terraspace/util/sure.rb
terraspace-2.2.3 lib/terraspace/util/sure.rb
terraspace-2.2.2 lib/terraspace/util/sure.rb
terraspace-2.2.1 lib/terraspace/util/sure.rb
terraspace-2.2.0 lib/terraspace/util/sure.rb
terraspace-2.1.7 lib/terraspace/util/sure.rb
terraspace-2.1.6 lib/terraspace/util/sure.rb