Module: Sambot::UI
- Defined in:
- lib/sambot/ui.rb
Constant Summary collapse
- @@silent =
false
Class Method Summary collapse
- .ask(msg) ⇒ Object
- .ask_password(msg) ⇒ Object
- .debug(msg) ⇒ Object
- .error(msg) ⇒ Object
- .info(msg) ⇒ Object
- .silent=(value) ⇒ Object
- .warn(msg) ⇒ Object
Class Method Details
.ask(msg) ⇒ Object
12 13 14 |
# File 'lib/sambot/ui.rb', line 12 def self.ask(msg) Thor.new.ask(msg) unless @@silent end |
.ask_password(msg) ⇒ Object
16 17 18 |
# File 'lib/sambot/ui.rb', line 16 def self.ask_password(msg) Thor.new.ask(msg, echo: false) unless @@silent end |
.debug(msg) ⇒ Object
25 26 27 28 |
# File 'lib/sambot/ui.rb', line 25 def self.debug(msg) date_format = DateTime.now.strftime('%Y-%m-%d %H:%M:%S') Thor.new.say("#{date_format} [D] #{msg}", :gray) unless @@silent end |
.error(msg) ⇒ Object
35 36 37 38 |
# File 'lib/sambot/ui.rb', line 35 def self.error(msg) date_format = DateTime.now.strftime('%Y-%m-%d %H:%M:%S') Thor.new.say("#{date_format} [E] #{msg}", :red) unless @@silent end |
.info(msg) ⇒ Object
30 31 32 33 |
# File 'lib/sambot/ui.rb', line 30 def self.info(msg) date_format = DateTime.now.strftime('%Y-%m-%d %H:%M:%S') Thor.new.say("#{date_format} [I] #{msg}", :green) unless @@silent end |
.silent=(value) ⇒ Object
8 9 10 |
# File 'lib/sambot/ui.rb', line 8 def self.silent=(value) @@silent = value end |
.warn(msg) ⇒ Object
20 21 22 23 |
# File 'lib/sambot/ui.rb', line 20 def self.warn(msg) date_format = DateTime.now.strftime('%Y-%m-%d %H:%M:%S') Thor.new.say("#{date_format} [W] #{msg}", :yellow) unless @@silent end |