Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/openstudio-standards/btap/btap.rb,
lib/openstudio-standards/utilities/template_measure/resources/BTAPMeasureHelper.rb
Overview
Add colourisation functionality to strings. Makes following test output easier.
Instance Method Summary collapse
-
#blue ⇒ Object
Use for start of tests/sections.
-
#colorize(color_code) ⇒ Object
colorization.
-
#green ⇒ Object
Use for success messages.
-
#light_blue ⇒ Object
Use for argument value reporting.
-
#pink ⇒ Object
Use for larger text dumps (e.g. whole files).
-
#red ⇒ Object
Use for error messages.
-
#to_bool ⇒ Object
This method converts to Boolean.
-
#yellow ⇒ Object
Use for warning messages.
Instance Method Details
#blue ⇒ Object
Use for start of tests/sections
435 436 437 |
# File 'lib/openstudio-standards/utilities/template_measure/resources/BTAPMeasureHelper.rb', line 435 def blue colorize(34) end |
#colorize(color_code) ⇒ Object
colorization
415 416 417 |
# File 'lib/openstudio-standards/utilities/template_measure/resources/BTAPMeasureHelper.rb', line 415 def colorize(color_code) "\e[#{color_code}m#{self}\e[0m" end |
#green ⇒ Object
Use for success messages
425 426 427 |
# File 'lib/openstudio-standards/utilities/template_measure/resources/BTAPMeasureHelper.rb', line 425 def green colorize(32) end |
#light_blue ⇒ Object
Use for argument value reporting
440 441 442 |
# File 'lib/openstudio-standards/utilities/template_measure/resources/BTAPMeasureHelper.rb', line 440 def light_blue colorize(36) end |
#pink ⇒ Object
Use for larger text dumps (e.g. whole files)
445 446 447 |
# File 'lib/openstudio-standards/utilities/template_measure/resources/BTAPMeasureHelper.rb', line 445 def pink colorize(35) end |
#red ⇒ Object
Use for error messages
420 421 422 |
# File 'lib/openstudio-standards/utilities/template_measure/resources/BTAPMeasureHelper.rb', line 420 def red colorize(31) end |
#to_bool ⇒ Object
This method converts to Boolean.
50 51 52 53 54 |
# File 'lib/openstudio-standards/btap/btap.rb', line 50 def to_bool return true if self == true || self =~ (/^(true|t|yes|y|1)$/i) return false if self == false || self =~ (/^(false|f|no|n|0)$/i) raise ArgumentError.new("invalid value for Boolean: \"#{self}\"") end |
#yellow ⇒ Object
Use for warning messages
430 431 432 |
# File 'lib/openstudio-standards/utilities/template_measure/resources/BTAPMeasureHelper.rb', line 430 def yellow colorize(33) end |