Exception: TinyClassifier::InvalidCategory

Inherits:
TinyClassifierError show all
Defined in:
lib/tiny-classifier/errors.rb

Direct Known Subclasses

InvalidCorrectCategory, InvalidWrongCategory

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(category, categories) ⇒ InvalidCategory

Returns a new instance of InvalidCategory.



59
60
61
62
# File 'lib/tiny-classifier/errors.rb', line 59

def initialize(category, categories)
  @category = category
  @categories = categories
end

Instance Attribute Details

#categoriesObject (readonly)

Returns the value of attribute categories.



57
58
59
# File 'lib/tiny-classifier/errors.rb', line 57

def categories
  @categories
end

#categoryObject (readonly)

Returns the value of attribute category.



57
58
59
# File 'lib/tiny-classifier/errors.rb', line 57

def category
  @category
end

Instance Method Details

#messageObject



64
65
66
# File 'lib/tiny-classifier/errors.rb', line 64

def message
  "You need to specify one of valid categories: #{@categories.join(", ")}"
end