Exception: Greeb::UnknownEntity

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/greeb/exceptions.rb

Overview

This runtime error appears when Tokenizer or Segmentator tries to recognize unknown character.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, pos) ⇒ UnknownEntity

Returns a new instance of UnknownEntity


8
9
10
# File 'lib/greeb/exceptions.rb', line 8

def initialize(text, pos)
  @text, @pos = text, pos
end

Instance Attribute Details

#posObject (readonly)

Returns the value of attribute pos


5
6
7
# File 'lib/greeb/exceptions.rb', line 5

def pos
  @pos
end

#textObject (readonly)

Returns the value of attribute text


5
6
7
# File 'lib/greeb/exceptions.rb', line 5

def text
  @text
end

Instance Method Details

#to_sObject

Generate the real error message.


14
15
16
# File 'lib/greeb/exceptions.rb', line 14

def to_s
  'Could not recognize character "%s" @ %d' % [text[pos], pos]
end