class ConceptAI
ConceptAI: Add more info to every Concept
instance.
Encapsulating AI data => questions
-
concept
-
questions
-
num
Attributes
concept[R]
excluded_questions[R]
questions[R]
Public Class Methods
new(concept, world)
click to toggle source
# File lib/asker/ai/concept_ai.rb, line 20 def initialize(concept, world) @concept = concept @world = world @questions = { d: [], b: [], f: [], i: [], s: [], t: [] } @excluded_questions = { d: [], b: [], f: [], i: [], s: [], t: [] } @num = 0 # Used to add a unique number to every question make_questions end
Public Instance Methods
method_missing(method, *args, &block)
click to toggle source
If a method call is missing, then delegate to concept parent.
# File lib/asker/ai/concept_ai.rb, line 35 def method_missing(method, *args, &block) @concept.send(method, *args, &block) end
num()
click to toggle source
# File lib/asker/ai/concept_ai.rb, line 29 def num @num += 1 @num.to_s end
random_image_for(_conceptname)
click to toggle source
# File lib/asker/ai/concept_ai.rb, line 39 def random_image_for(_conceptname) return '' if rand <= Project.instance.get(:threshold) keys = @world.image_urls.keys keys.shuffle! values = @world.image_urls[keys[0]] # keys[0] could be conceptname return '' if values.nil? values.shuffle! "<img src=\"#{values[0]}\" alt\=\"image\"><br/>" end