Class: James::Markers::Memory
- Defined in:
- lib/james/markers/memory.rb
Overview
A marker is a point in conversation where we once were and might go back.
TODO: Rename to ?.
Instance Attribute Summary
Attributes inherited from Marker
Instance Method Summary collapse
- #current? ⇒ Boolean
-
#expects ⇒ Object
A marker does not care about phrases that cross dialog boundaries.
-
#hear(phrase, &block) ⇒ Object
Hear a phrase.
Methods inherited from Marker
#chainable?, #check, #enter, #exit, #hears?, #initialize, #process, #reset, #to_s, #transition
Constructor Details
This class inherits a constructor from James::Markers::Marker
Instance Method Details
#current? ⇒ Boolean
29 30 31 |
# File 'lib/james/markers/memory.rb', line 29 def current? false end |
#expects ⇒ Object
A marker does not care about phrases that cross dialog boundaries.
25 26 27 |
# File 'lib/james/markers/memory.rb', line 25 def expects current.internal_expects end |
#hear(phrase, &block) ⇒ Object
Hear a phrase.
Returns a new Current if it heard. Returns itself if not.
17 18 19 20 21 |
# File 'lib/james/markers/memory.rb', line 17 def hear phrase, &block return [self] unless hears? phrase last = current process(phrase, &block) ? [Memory.new(last), Current.new(current)] : [Current.new(current)] end |