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

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

Constant Summary collapse

CURSOR =
'@'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(message, template, position) ⇒ SyntaxError

Returns a new instance of SyntaxError.



20
21
22
23
24
# File 'lib/jekyll/minibundle/variable_template.rb', line 20

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

Instance Method Details

#to_sObject



26
27
28
29
30
31
32
33
34
# File 'lib/jekyll/minibundle/variable_template.rb', line 26

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

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