Exception: WitBot::LowConfidenceError

Inherits:
WitBotError
  • Object
show all
Defined in:
lib/wit_bot/errors/low_confidence_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(outcome, minimum_confidence = config.minimum_confidence) ⇒ LowConfidenceError

Returns a new instance of LowConfidenceError.



5
6
7
8
9
10
# File 'lib/wit_bot/errors/low_confidence_error.rb', line 5

def initialize(outcome, minimum_confidence=config.minimum_confidence)
  @outcome = outcome
  @message = outcome.message
  @confidence = outcome.confidence
  @minimum_confidence = minimum_confidence
end

Instance Attribute Details

#confidenceObject (readonly)

Returns the value of attribute confidence.



3
4
5
# File 'lib/wit_bot/errors/low_confidence_error.rb', line 3

def confidence
  @confidence
end

#messageObject (readonly)

Returns the value of attribute message.



3
4
5
# File 'lib/wit_bot/errors/low_confidence_error.rb', line 3

def message
  @message
end

#minimum_confidenceObject (readonly)

Returns the value of attribute minimum_confidence.



3
4
5
# File 'lib/wit_bot/errors/low_confidence_error.rb', line 3

def minimum_confidence
  @minimum_confidence
end

#outcomeObject (readonly)

Returns the value of attribute outcome.



3
4
5
# File 'lib/wit_bot/errors/low_confidence_error.rb', line 3

def outcome
  @outcome
end

Instance Method Details

#to_sObject



12
13
14
# File 'lib/wit_bot/errors/low_confidence_error.rb', line 12

def to_s
  "Confidence (#{confidence}) is lower then the minimum (#{minimum_confidence})"
end