Class: Minitest::Heat::Output::Token
- Inherits:
-
Object
- Object
- Minitest::Heat::Output::Token
- Defined in:
- lib/minitest/heat/output/token.rb
Overview
Provides a convenient interface for creating console-friendly output while ensuring
consistency in the applied styles.
Defined Under Namespace
Classes: InvalidStyle
Constant Summary collapse
- STYLES =
{ success: %i[default green], slow: %i[default green], painful: %i[bold green], error: %i[bold red], broken: %i[bold red], failure: %i[default red], skipped: %i[default yellow], warning_light: %i[light yellow], italicized: %i[italic gray], bold: %i[bold default], default: %i[default default], muted: %i[light gray] }.freeze
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#style_key ⇒ Object
Returns the value of attribute style_key.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
-
#initialize(style_key, content) ⇒ Token
constructor
A new instance of Token.
- #to_s(format = :styled) ⇒ Object
Constructor Details
#initialize(style_key, content) ⇒ Token
Returns a new instance of Token.
28 29 30 31 |
# File 'lib/minitest/heat/output/token.rb', line 28 def initialize(style_key, content) @style_key = style_key @content = content end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
26 27 28 |
# File 'lib/minitest/heat/output/token.rb', line 26 def content @content end |
#style_key ⇒ Object
Returns the value of attribute style_key.
26 27 28 |
# File 'lib/minitest/heat/output/token.rb', line 26 def style_key @style_key end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
43 44 45 |
# File 'lib/minitest/heat/output/token.rb', line 43 def eql?(other) style_key == other.style_key && content == other.content end |
#to_s(format = :styled) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/minitest/heat/output/token.rb', line 33 def to_s(format = :styled) return content unless format == :styled [ style_string, content, reset_string ].join end |