class Actor::Filter

Attributes

timeout[R]
timeout_action[R]

Public Class Methods

new() click to toggle source
# File lib/girl_friday/actor.rb, line 438
def initialize
  @pairs = []
  @timeout = nil
  @timeout_action = nil
end

Public Instance Methods

action_for(value) click to toggle source
# File lib/girl_friday/actor.rb, line 465
def action_for(value)
  pair = @pairs.find { |pattern, action| pattern === value }
  pair ? pair.last : nil
end
after(seconds, &action) click to toggle source
# File lib/girl_friday/actor.rb, line 454
def after(seconds, &action)
  raise ArgumentError, "no block given" unless action

  seconds = seconds.to_f
  if !@timeout or seconds < @timeout
    @timeout = seconds
    @timeout_action = action
  end
  self
end
timeout?() click to toggle source
# File lib/girl_friday/actor.rb, line 444
def timeout?
  not @timeout.nil?
end
when(pattern, &action) click to toggle source
# File lib/girl_friday/actor.rb, line 448
def when(pattern, &action)
  raise ArgumentError, "no block given" unless action
  @pairs.push [pattern, action]
  self
end