module Affect
Affect
module
Affect
module
Constants
- VERSION
Public Instance Methods
block_and_handlers_from_args(*args, &block)
click to toggle source
# File lib/affect.rb, line 67 def block_and_handlers_from_args(*args, &block) case args.size when 1 then block ? [block, args.first] : [args.first, nil] when 2 then args else [block, nil] end end
capture(*args, &block)
click to toggle source
# File lib/affect.rb, line 61 def capture(*args, &block) block, handlers = block_and_handlers_from_args(*args, &block) handlers = { nil => handlers } if handlers.is_a?(Proc) Context.new(handlers).capture(&block) end
escape(value = nil, &block)
click to toggle source
# File lib/affect.rb, line 83 def escape(value = nil, &block) unless (ctx = Context.current) raise 'escape called outside capture block' end ctx.escape(value, &block) end
method_missing(*args, &block)
click to toggle source
# File lib/affect.rb, line 95 def method_missing(*args, &block) perform(*args, &block) end
perform(effect, *args, &block)
click to toggle source
# File lib/affect.rb, line 75 def perform(effect, *args, &block) unless (ctx = Context.current) raise 'perform called outside capture block' end ctx.perform(effect, *args, &block) end
respond_to_missing?(*)
click to toggle source
# File lib/affect.rb, line 91 def respond_to_missing?(*) true end