Exception: RockBooks::IncorrectSequenceError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/rock_books/errors/incorrect_sequence_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tokens, journal_entry_context) ⇒ IncorrectSequenceError

Returns a new instance of IncorrectSequenceError.



9
10
11
12
13
# File 'lib/rock_books/errors/incorrect_sequence_error.rb', line 9

def initialize(tokens, journal_entry_context)
  self.tokens = tokens
  self.journal_entry_context = journal_entry_context
  super(to_s)
end

Instance Attribute Details

#journal_entry_contextObject

Returns the value of attribute journal_entry_context.



7
8
9
# File 'lib/rock_books/errors/incorrect_sequence_error.rb', line 7

def journal_entry_context
  @journal_entry_context
end

#tokensObject

Returns the value of attribute tokens.



7
8
9
# File 'lib/rock_books/errors/incorrect_sequence_error.rb', line 7

def tokens
  @tokens
end

Instance Method Details

#to_sObject



16
17
18
19
# File 'lib/rock_books/errors/incorrect_sequence_error.rb', line 16

def to_s
  ctx = journal_entry_context
  "Incorrect token sequence in journal '#{ctx.journal.short_name}', line ##{ctx.linenum}: #{tokens.inspect}"
end