Class: Diskman::Confirmer

Inherits:
Object
  • Object
show all
Defined in:
lib/diskman/confirmer.rb

Overview

Confirms whether the user wants to do something destructive.

Constant Summary collapse

YES =
'YES'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.check!Object



6
7
8
# File 'lib/diskman/confirmer.rb', line 6

def self.check!
    new.check!
end

Instance Method Details

#check!Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/diskman/confirmer.rb', line 10

def check!
    puts
    puts 'Are you sure? Type "%s" if so.' % YES
    puts

    print '> '

    if $stdin.gets.chomp != YES
        raise Interrupt
    end
end