class Fibril::FibrilProxy

Constants

ENUM_METHODS

Attributes

guard_names[RW]
target[RW]

Public Class Methods

new(target, *guard_names) click to toggle source
# File lib/fibril/fibril_proxy.rb, line 6
def initialize(target, *guard_names)
  self.target = target
  self.guard_names = guard_names
end

Public Instance Methods

method_missing(name, *args, &block) click to toggle source

Execute target method within a new fibril

# File lib/fibril/fibril_proxy.rb, line 14
def method_missing(name, *args, &block)

  context = target

  return context.send(name).fibril(*self.guard_names) do |*elms, &blk|
    block[*elms, &blk]
  end if ENUM_METHODS.include?(name.to_s)


  fibril{
    context.send(name, *args, &block)
  }.tap do |guard|
    guard_names.each do |guard_name|
      Fibril.guard.send("#{guard_name}=", guard)
    end
  end
end