class Lingo::DeferredAttendee

Public Class Methods

enhance(base) click to toggle source
# File lib/lingo/deferred_attendee.rb, line 30
def self.enhance(base)
  base.instance_variable_set(:@deferr_buffer, [])

  def base.command(*args)
    @deferr_buffer << buf = [args]

    args.first != :EOT ? buf << control_deferred(*args) :
      flush_deferred { |block|
        @deferr_buffer.each { |command_args, control_args|
          super(*command_args)
          block[*control_args] if control_args
        }
      }
  end
end
new(config, lingo) click to toggle source
Calls superclass method Lingo::Attendee.new
# File lib/lingo/deferred_attendee.rb, line 46
def initialize(config, lingo)
  self.class.enhance(self)
  super
end

Public Instance Methods

control_deferred(cmd, *) click to toggle source
# File lib/lingo/deferred_attendee.rb, line 51
def control_deferred(cmd, *)
  raise NotImplementedError, 'must be implemented by subclass'
end
flush_deferred(&block) click to toggle source
# File lib/lingo/deferred_attendee.rb, line 55
def flush_deferred(&block)
  raise NotImplementedError, 'must be implemented by subclass'
end