Sha256: 9153bc8b95439a512328345aa4c7f9c596128c110bd087a61f014f7f292ad5fa

Contents?: true

Size: 443 Bytes

Versions: 36

Compression:

Stored size: 443 Bytes

Contents

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

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

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
ufo-6.3.13 lib/ufo/utils/sure.rb
ufo-6.3.12 lib/ufo/utils/sure.rb
ufo-6.3.11 lib/ufo/utils/sure.rb
ufo-6.3.10 lib/ufo/utils/sure.rb
ufo-6.3.9 lib/ufo/utils/sure.rb
ufo-6.3.8 lib/ufo/utils/sure.rb
ufo-6.3.7 lib/ufo/utils/sure.rb
ufo-6.3.6 lib/ufo/utils/sure.rb
ufo-6.3.5 lib/ufo/utils/sure.rb
ufo-6.3.4 lib/ufo/utils/sure.rb
ufo-6.3.3 lib/ufo/utils/sure.rb
ufo-6.3.2 lib/ufo/utils/sure.rb
ufo-6.3.1 lib/ufo/utils/sure.rb
ufo-6.3.0 lib/ufo/utils/sure.rb
ufo-6.2.5 lib/ufo/utils/sure.rb
ufo-6.2.4 lib/ufo/utils/sure.rb
ufo-6.2.3 lib/ufo/utils/sure.rb
ufo-6.2.2 lib/ufo/utils/sure.rb
ufo-6.2.1 lib/ufo/utils/sure.rb
ufo-6.2.0 lib/ufo/utils/sure.rb