Class: Diary::Message
- Inherits:
-
Object
- Object
- Diary::Message
- Defined in:
- lib/diary/message.rb
Defined Under Namespace
Modules: Shorthand
Constant Summary collapse
- DEFAULT_PADDING =
12
- CLEAR =
Embed in a String to clear all previous ANSI sequences.
"\e[0m"
- BOLD =
Embed in a String to add bold
"\e[1m"
- BLACK =
Embed in a String to add color
"\e[30m"
- RED =
"\e[31m"
- GREEN =
"\e[32m"
- YELLOW =
"\e[33m"
- BLUE =
"\e[34m"
- MAGENTA =
"\e[35m"
- CYAN =
"\e[36m"
- WHITE =
"\e[37m"
Instance Method Summary collapse
-
#initialize(keyword, message, color = false) ⇒ Message
constructor
A new instance of Message.
Constructor Details
#initialize(keyword, message, color = false) ⇒ Message
Returns a new instance of Message.
19 20 21 22 23 24 |
# File 'lib/diary/message.rb', line 19 def initialize(keyword, , color = false) keyword = add_padding(keyword.to_s) keyword = set_color(keyword, color) if color $stdout.puts "#{keyword} #{}" end |