Class: ProgramR::Random

Inherits:
AimlTag show all
Defined in:
lib/programr/aiml_elements.rb

Instance Method Summary collapse

Methods inherited from AimlTag

#inspect, #to_s

Constructor Details

#initializeRandom

Returns a new instance of Random.


83
84
85
# File 'lib/programr/aiml_elements.rb', line 83

def initialize
  @condition_items = []
end

Instance Method Details

#add(aBody) ⇒ Object


91
92
93
# File 'lib/programr/aiml_elements.rb', line 91

def add aBody
  @condition_items[-1].add(aBody)
end

#executeObject


95
96
97
# File 'lib/programr/aiml_elements.rb', line 95

def execute
  @condition_items.sample.execute
end

#setListElement(condition_item) ⇒ Object


87
88
89
# File 'lib/programr/aiml_elements.rb', line 87

def setListElement condition_item
  @condition_items << condition_item
end