Sha256: aed78e0a46b4af612293ace2daeb35ffe77abea811a49c0f5eac62ddb705f661
Contents?: true
Size: 764 Bytes
Versions: 5
Compression:
Stored size: 764 Bytes
Contents
module LambdaDriver::Op module Proxy def _(method = nil) method ? ::LambdaDriver::Op.method_or_lambda(self, method) : OpProxy.new(self) end end def method_or_lambda(obj, method) (obj.respond_to?(method) && obj.method(method)) || lambda{|*args| obj.__send__(method, *args) } end module_function :method_or_lambda class BlankSlate instance_methods.each { |m| undef_method m unless m =~ /^(__|object_id)/ } end class OpProxy < (RUBY_VERSION < '1.9.0' ? BlankSlate : BasicObject) def initialize(obj) @obj = obj end def call(method) ::LambdaDriver::Op.method_or_lambda(@obj, method) end def method_missing(method) ::LambdaDriver::Op.method_or_lambda(@obj, method) end end end
Version data entries
5 entries across 5 versions & 1 rubygems