Class: James::Markers::Current
- Defined in:
- lib/james/markers/current.rb
Overview
The visitor knows where in the conversation we are.
Instance Attribute Summary
Attributes inherited from Marker
Instance Method Summary collapse
- #current? ⇒ Boolean
-
#expects ⇒ Object
Expects all phrases, not just internal.
-
#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
26 27 28 |
# File 'lib/james/markers/current.rb', line 26 def current? true end |
#expects ⇒ Object
Expects all phrases, not just internal.
22 23 24 |
# File 'lib/james/markers/current.rb', line 22 def expects current.expects end |
#hear(phrase, &block) ⇒ Object
Hear a phrase.
Returns a new marker and self if it crossed a boundary. Returns itself if not.
14 15 16 17 18 |
# File 'lib/james/markers/current.rb', line 14 def hear phrase, &block return [self] unless hears? phrase last = current process(phrase, &block) ? [Memory.new(last), self] : [self] end |