Sha256: 2651fa8b31453594890df9b2fbd2ca91492b1e41708a4ba5935f849c81c16452
Contents?: true
Size: 1021 Bytes
Versions: 2
Compression:
Stored size: 1021 Bytes
Contents
# encoding: utf-8 module CSD class UI include Gem::UserInteraction # These are all possible user interactions provided by the UI # INTERACTIONS = %w{ separator debug info warn error ask ask_yes_no } def separator say end def debug(message) say "DEBUG: #{message}".magenta if Options.debug and !Options.silent end def info(message) say message if !Options.silent end def warn(message) say message.red if !Options.silent end def error(message) if !Options.silent say 'ERROR: '.red.blink + message.red end end def die(message) say message.red.blink if !Options.silent exit end protected # This is just a convenience wrapper so that +UI.myinteraction+ will map to +CSD.ui.myinteraction+ # def self.method_missing(meth, *args, &block) INTERACTIONS.include?(meth.to_s) ? CSD.ui.send(meth.to_sym, *args, &block) : super end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
csd-0.1.4 | lib/csd/ui/ui.rb |
csd-0.1.3 | lib/csd/ui/ui.rb |