Module: PhilColumns::Output

Included in:
Command::Base, Migrator, Purger, Seeder
Defined in:
lib/phil_columns/output.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
# File 'lib/phil_columns/output.rb', line 4

def self.included( base )
  base.send( :include, Thor::Shell )
end

Instance Method Details

#confirm(msg, color = :white, &block) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/phil_columns/output.rb', line 28

def confirm( msg, color=:white, &block )
  write msg, color
  block.call
  say_ok
rescue
  say_error
  raise
end

#say(msg, color = :white) ⇒ Object



12
13
14
# File 'lib/phil_columns/output.rb', line 12

def say( msg, color=:white )
  $stdout.puts( Rainbow( msg ).color( color ))
end

#say_errorObject



20
21
22
# File 'lib/phil_columns/output.rb', line 20

def say_error
  say 'ERROR', :red
end

#say_okObject



16
17
18
# File 'lib/phil_columns/output.rb', line 16

def say_ok
  say 'OK', :green
end

#say_skippingObject



24
25
26
# File 'lib/phil_columns/output.rb', line 24

def say_skipping
  say 'SKIPPING', :yellow
end

#write(msg, color = :white) ⇒ Object



8
9
10
# File 'lib/phil_columns/output.rb', line 8

def write( msg, color=:white )
  $stdout.write( Rainbow( msg ).color( color ))
end