Module: Omnitest::Core::Util::String::ClassMethods
- Included in:
- Omnitest::Core::Util::String
- Defined in:
- lib/omnitest/core/util.rb
Instance Method Summary collapse
- #ansi2html(text) ⇒ Object
- #escape_html(text) ⇒ Object (also: #h)
- #highlight(source, opts = {}) ⇒ Object
- #slugify(*labels) ⇒ Object
Instance Method Details
#ansi2html(text) ⇒ Object
110 111 112 |
# File 'lib/omnitest/core/util.rb', line 110 def ansi2html(text) HTML.from_ansi(text) end |
#escape_html(text) ⇒ Object Also known as: h
114 115 116 |
# File 'lib/omnitest/core/util.rb', line 114 def escape_html(text) HTML.escape_html(text) end |
#highlight(source, opts = {}) ⇒ Object
119 120 121 122 123 124 125 |
# File 'lib/omnitest/core/util.rb', line 119 def highlight(source, opts = {}) return nil if source.nil? opts[:language] ||= 'ruby' opts[:formatter] ||= 'terminal256' Highlight.new(opts).highlight(source) end |
#slugify(*labels) ⇒ Object
104 105 106 107 108 |
# File 'lib/omnitest/core/util.rb', line 104 def slugify(*labels) labels.map do |label| label.downcase.gsub(/[\.\s-]/, '_') end.join('-') end |