Exception: Jekyll::Minibundle::VariableTemplate::SyntaxError

Inherits:
ArgumentError
  • Object
show all
Defined in:
lib/jekyll/minibundle/variable_template.rb

Constant Summary collapse

CURSOR =
'@'

Instance Method Summary collapse

Constructor Details

#initialize(message, template, position) ⇒ SyntaxError

Returns a new instance of SyntaxError.



24
25
26
27
28
29
# File 'lib/jekyll/minibundle/variable_template.rb', line 24

def initialize(message, template, position)
  super()
  @message = message
  @template = template
  @position = position
end

Instance Method Details

#to_sObject



31
32
33
34
35
36
37
38
39
# File 'lib/jekyll/minibundle/variable_template.rb', line 31

def to_s
  template_before_pos = @template[0, @position]
  template_after_pos = @template[@position..]

  <<~MESSAGE
    #{@message} at position #{@position} in template (position highlighted with "#{CURSOR}"):
    #{template_before_pos}#{CURSOR}#{template_after_pos}
  MESSAGE
end