Exception: Lingo::TokenizeError

Inherits:
LingoError
  • Object
show all
Defined in:
lib/lingo/error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from LingoError

#class_name, #error

Constructor Details

#initialize(line, file, num, err) ⇒ TokenizeError

Returns a new instance of TokenizeError.



225
226
227
# File 'lib/lingo/error.rb', line 225

def initialize(line, file, num, err)
  @line, @file, @num, @err = line, file, num, err
end

Instance Attribute Details

#errObject (readonly)

Returns the value of attribute err.



223
224
225
# File 'lib/lingo/error.rb', line 223

def err
  @err
end

#fileObject (readonly)

Returns the value of attribute file.



223
224
225
# File 'lib/lingo/error.rb', line 223

def file
  @file
end

#lineObject (readonly)

Returns the value of attribute line.



223
224
225
# File 'lib/lingo/error.rb', line 223

def line
  @line
end

#numObject (readonly)

Returns the value of attribute num.



223
224
225
# File 'lib/lingo/error.rb', line 223

def num
  @num
end

Instance Method Details

#to_sObject



229
230
231
232
233
234
235
236
237
238
239
# File 'lib/lingo/error.rb', line 229

def to_s
  line, file = self.line, self.file

  if line.is_a?(String) && line.length > 48
    line = line[0, 45] + '...'
  end

  file &&= "#{file}:#{num}: "

  error("An error occured while trying to tokenize #{file}#{line.inspect}")
end