Class: Mustermann::Visualizer::Highlight

Inherits:
Object
  • Object
show all
Defined in:
lib/mustermann/visualizer/highlight.rb

Overview

Meta class for highlight objects.

See Also:

Instance Method Summary collapse

Instance Method Details

#stylesheet(**options) ⇒ String

Returns stylesheet for HTML output from the pattern.

Returns:

  • (String)

    stylesheet for HTML output from the pattern



122
123
124
# File 'lib/mustermann/visualizer/highlight.rb', line 122

def stylesheet(**options)
  Renderer::HTML.new(self, **options).stylesheet
end

#to_ansi(**options) ⇒ String

Returns ANSI colorized version of the pattern.

Examples:

require 'mustermann/visualizer'

pattern   = Mustermann.new('/:name')
highlight = Mustermann::Visualizer.highlight(pattern)

puts highlight.to_ansi

Returns:

  • (String)

    ANSI colorized version of the pattern



81
82
83
# File 'lib/mustermann/visualizer/highlight.rb', line 81

def to_ansi(**options)
  render_with(Renderer::ANSI, **options)
end

#to_hansi_template(**options) ⇒ String

Returns Hansi template representation of the pattern.

Examples:

require 'mustermann/visualizer'

pattern   = Mustermann.new('/:name')
highlight = Mustermann::Visualizer.highlight(pattern)

puts highlight.to_hansi_template

Returns:

  • (String)

    Hansi template representation of the pattern



68
69
70
# File 'lib/mustermann/visualizer/highlight.rb', line 68

def to_hansi_template(**options)
  render_with(Renderer::HansiTemplate, **options)
end

#to_html(**options) ⇒ String

Returns HTML rendering of the pattern.

Examples:

require 'mustermann/visualizer'

pattern   = Mustermann.new('/:name')
highlight = Mustermann::Visualizer.highlight(pattern)

puts highlight.to_html

Returns:

  • (String)

    HTML rendering of the pattern



94
95
96
# File 'lib/mustermann/visualizer/highlight.rb', line 94

def to_html(**options)
  render_with(Renderer::HTML, **options)
end

#to_patternMustermann::Pattern

Returns the pattern used to create the highlight object.

Returns:

  • (Mustermann::Pattern)

    the pattern used to create the highlight object



112
113
114
# File 'lib/mustermann/visualizer/highlight.rb', line 112

def to_pattern
  pattern
end

#to_sString

Returns string representation of the pattern.

Returns:

  • (String)

    string representation of the pattern



117
118
119
# File 'lib/mustermann/visualizer/highlight.rb', line 117

def to_s
  pattern.to_s
end

#to_sexp(**options) ⇒ String

Returns s-expression like representation of the pattern.

Examples:

require 'mustermann/visualizer'

pattern   = Mustermann.new('/:name')
highlight = Mustermann::Visualizer.highlight(pattern)

puts highlight.to_sexp

Returns:

  • (String)

    s-expression like representation of the pattern



107
108
109
# File 'lib/mustermann/visualizer/highlight.rb', line 107

def to_sexp(**options)
  render_with(Renderer::Sexp, **options)
end