Class: Apollo::Bot::Classification

Inherits:
Object
  • Object
show all
Defined in:
lib/apollo/bot/classification.rb

Defined Under Namespace

Classes: Class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Classification

Returns a new instance of Classification.



16
17
18
19
20
21
# File 'lib/apollo/bot/classification.rb', line 16

def initialize(attrs = {})
  @classifier_id = attrs["classifier_id"]
  @text = attrs["text"]
  @top_class = attrs["top_class"]
  @classes = attrs["classes"].map { |attrs| Apollo::Bot::Classification::Class.new(attrs) }
end

Instance Attribute Details

#classesObject (readonly)

Returns the value of attribute classes.



14
15
16
# File 'lib/apollo/bot/classification.rb', line 14

def classes
  @classes
end

#classifier_idObject (readonly)

Returns the value of attribute classifier_id.



14
15
16
# File 'lib/apollo/bot/classification.rb', line 14

def classifier_id
  @classifier_id
end

#textObject (readonly)

Returns the value of attribute text.



14
15
16
# File 'lib/apollo/bot/classification.rb', line 14

def text
  @text
end

#top_classObject (readonly)

Returns the value of attribute top_class.



14
15
16
# File 'lib/apollo/bot/classification.rb', line 14

def top_class
  @top_class
end

Instance Method Details

#classifierObject



23
24
25
# File 'lib/apollo/bot/classification.rb', line 23

def classifier
  @classifier ||= Apollo::Bot::Classifier.find(classifier_id)
end