Class: ProgramR::History
- Inherits:
-
Object
- Object
- ProgramR::History
- Defined in:
- lib/programr/history.rb
Constant Summary collapse
- @@topic =
'default'
- @@inputs =
[]
- @@responses =
[]
- @@starGreedy =
[]
- @@thatGreedy =
[]
- @@topicGreedy =
[]
Instance Method Summary collapse
- #beforethat ⇒ Object
- #getStar(anIndex) ⇒ Object
- #getStimula(anIndex) ⇒ Object
- #getThatStar(anIndex) ⇒ Object
- #getTopicStar(anIndex) ⇒ Object
- #justbeforethat ⇒ Object
- #justthat ⇒ Object
- #that ⇒ Object
- #topic ⇒ Object
- #updateResponse(aResponse) ⇒ Object
- #updateStarMatches(aStarGreedyArray) ⇒ Object
- #updateStimula(aStimula) ⇒ Object
- #updateTopic(aTopic) ⇒ Object
Instance Method Details
#beforethat ⇒ Object
27 28 29 30 |
# File 'lib/programr/history.rb', line 27 def beforethat return 'undef' unless @@inputs[1] @@inputs[1] end |
#getStar(anIndex) ⇒ Object
32 33 34 35 |
# File 'lib/programr/history.rb', line 32 def getStar(anIndex) return 'undef' unless @@starGreedy[anIndex] @@starGreedy[anIndex].join(' ') end |
#getStimula(anIndex) ⇒ Object
59 60 61 |
# File 'lib/programr/history.rb', line 59 def getStimula(anIndex) @@inputs[anIndex] end |
#getThatStar(anIndex) ⇒ Object
37 38 39 40 |
# File 'lib/programr/history.rb', line 37 def getThatStar(anIndex) return 'undef' unless @@thatGreedy[anIndex] @@thatGreedy[anIndex].join(' ') end |
#getTopicStar(anIndex) ⇒ Object
42 43 44 45 |
# File 'lib/programr/history.rb', line 42 def getTopicStar(anIndex) return 'undef' unless @@topicGreedy[anIndex] @@topicGreedy[anIndex].join(' ') end |
#justbeforethat ⇒ Object
17 18 19 20 |
# File 'lib/programr/history.rb', line 17 def justbeforethat return 'undef' unless @@responses[1] @@responses[1] end |
#justthat ⇒ Object
22 23 24 25 |
# File 'lib/programr/history.rb', line 22 def justthat return 'undef' unless @@inputs[0] @@inputs[0] end |
#that ⇒ Object
12 13 14 15 |
# File 'lib/programr/history.rb', line 12 def that return 'undef' unless @@responses[0] @@responses[0] end |
#topic ⇒ Object
10 |
# File 'lib/programr/history.rb', line 10 def topic; @@topic end |
#updateResponse(aResponse) ⇒ Object
51 52 53 |
# File 'lib/programr/history.rb', line 51 def updateResponse(aResponse) @@responses.unshift(aResponse) end |
#updateStarMatches(aStarGreedyArray) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/programr/history.rb', line 63 def updateStarMatches(aStarGreedyArray) @@starGreedy = [] @@thatGreedy = [] @@topicGreedy = [] currentGreedy = @@starGreedy aStarGreedyArray.each do |greedy| if(greedy == '<that>') currentGreedy = @@thatGreedy elsif(greedy == '<topic>') currentGreedy = @@topicGreedy elsif(greedy == '<newMatch>') currentGreedy.push([]) else currentGreedy[-1].push(greedy) end end end |
#updateStimula(aStimula) ⇒ Object
55 56 57 |
# File 'lib/programr/history.rb', line 55 def updateStimula(aStimula) @@inputs.unshift(aStimula) end |
#updateTopic(aTopic) ⇒ Object
47 48 49 |
# File 'lib/programr/history.rb', line 47 def updateTopic(aTopic) @@topic = aTopic end |