Module: Gibbler::Block
Overview
Return the digest for class:arity:binding, where:
-
class is the current class name (e.g. Proc)
-
arity is the value returned by
Proc#arity -
value of lambda? if available (Ruby 1.9) or false otherwise
This method can be used by any subclass of Proc.
NOTE: This is named “Block” because for some reason if this is named “Proc” (as in Gibbler::Proc) and the Rye library is also required, a runtime error is raised (Ruby 1.9.1 only):
undefined method `new' for Gibbler::Proc:Module
/usr/local/lib/ruby/1.9.1/tempfile.rb:169:in `callback'
/usr/local/lib/ruby/1.9.1/tempfile.rb:61:in `initialize'
/Users/delano/Projects/opensource/rye/lib/rye.rb:210:in `new'
Class Method Summary collapse
Instance Method Summary collapse
-
#__gibbler(h = self) ⇒ Object
Creates a digest for the current state of self.
Methods included from Object
#gibbled?, #gibbler, #gibbler_debug
Class Method Details
.included(obj) ⇒ Object
247 248 249 250 |
# File 'lib/gibbler.rb', line 247 def self.included(obj) obj.extend Attic obj.attic :__gibbler_cache end |
Instance Method Details
#__gibbler(h = self) ⇒ Object
Creates a digest for the current state of self.
253 254 255 256 257 258 259 |
# File 'lib/gibbler.rb', line 253 def __gibbler(h=self) klass = h.class is_lambda = h.respond_to?(:lambda?) ? h.lambda? : false a = Gibbler.digest '%s:%s:%s' % [klass, h.arity, is_lambda] gibbler_debug klass, a, [klass, h.arity, is_lambda] a end |