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-0.2.0 lib/terraspace/util/sure.rb
terraspace-0.1.2 lib/terraspace/util/sure.rb
terraspace-0.1.1 lib/terraspace/util/sure.rb
terraspace-0.1.0 lib/terraspace/util/sure.rb