Module: Tumbler::Informer
- Included in:
- Gem, Generate, Manager, Manager::Changelog, Manager::Version, Updater
- Defined in:
- lib/tumbler/informer.rb
Constant Summary collapse
- Colors =
[:green, :cyan, :blue, :magenta]
Instance Method Summary collapse
Instance Method Details
#inform(msg, &block) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/tumbler/informer.rb', line 8 def inform(msg, &block) $stderr.puts(' ' * $informer_indent << msg.color(Colors[$informer_indent % Colors.size])) $informer_indent += 1 begin block.call if block rescue Exception $stderr.puts "#{msg} failed!".color(:red) raise ensure $informer_indent -= 1 end end |