Class: VkillGemsMethods::STD::Display
- Inherits:
-
Object
- Object
- VkillGemsMethods::STD::Display
- Defined in:
- lib/vkill_gems_methods/std.rb
Constant Summary collapse
- ANSI_COLOR =
%w(black red green yellow blue magenta cyan white)
Instance Attribute Summary collapse
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#header ⇒ Object
readonly
Returns the value of attribute header.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#rjust_integer ⇒ Object
readonly
Returns the value of attribute rjust_integer.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(*options, &block) ⇒ Display
constructor
A new instance of Display.
Constructor Details
#initialize(*options, &block) ⇒ Display
Returns a new instance of Display.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/vkill_gems_methods/std.rb', line 11 def initialize(*, &block) = . header = .delete(:header) || "info" text = .delete(:text) || "" color = .delete(:color) || 'green' rjust_integer = .delete(:rjust_integer) || 12 @header = header.to_s @text = text.to_s @color = ANSI_COLOR.include?(color.to_s) ? color.to_s : 'green' @rjust_integer = rjust_integer.to_i @c = Term::ANSIColor @output = "" @output << eval("#{@c}.#{@color}") @output << @header.capitalize.rjust(@rjust_integer) @output << @c.clear @output << " #{ @text }" end |
Instance Attribute Details
#color ⇒ Object (readonly)
Returns the value of attribute color.
9 10 11 |
# File 'lib/vkill_gems_methods/std.rb', line 9 def color @color end |
#header ⇒ Object (readonly)
Returns the value of attribute header.
9 10 11 |
# File 'lib/vkill_gems_methods/std.rb', line 9 def header @header end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
9 10 11 |
# File 'lib/vkill_gems_methods/std.rb', line 9 def output @output end |
#rjust_integer ⇒ Object (readonly)
Returns the value of attribute rjust_integer.
9 10 11 |
# File 'lib/vkill_gems_methods/std.rb', line 9 def rjust_integer @rjust_integer end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
9 10 11 |
# File 'lib/vkill_gems_methods/std.rb', line 9 def text @text end |