Sha256: f8916b70571072aa2e94945641b9c5f9957d250c46694ff334ec59edb9e279df
Contents?: true
Size: 483 Bytes
Versions: 2
Compression:
Stored size: 483 Bytes
Contents
class NSObject def add_block_method(sym, &block) block_methods[sym] = block nil end def method_missing(sym, *args, &block) if block_methods.keys.member? sym return block_methods[sym].call(*args, &block) end raise NoMethodError.new("undefined method `#{sym}' for " + "#{self.inspect}:#{self.class.name}") end def methods methods = super methods + block_methods.keys end private def block_methods @block_methods ||= {} end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
routable-0.0.2 | lib/routable/ns_object.rb |
routable-0.0.1 | lib/routable/ns_object.rb |