Skip to content
Permalink
Browse files

expose default proc on hash

  • Loading branch information
Alex Gaynor
Alex Gaynor committed Apr 7, 2013
1 parent 7865d82 commit 62d233ba4a5e4097f55866dfd76c31cfef4ad547
Showing with 6 additions and 2 deletions.
  1. +0 −2 spec/tags/core/hash/default_proc_tags.txt
  2. +6 −0 topaz/objects/hashobject.py
@@ -1,5 +1,3 @@
fails:Hash#default_proc returns the block passed to Hash.new
fails:Hash#default_proc returns nil if no block was passed to proc
fails:Hash#default_proc= replaces the block passed to Hash.new
fails:Hash#default_proc= uses :to_proc on its argument
fails:Hash#default_proc= overrides the static default
@@ -44,6 +44,12 @@ def method_default(self, space, w_key=None):
else:
return self.w_default

@classdef.method("default_proc")
def method_default_proc(self, space):
if self.default_proc is None:
return space.w_nil
return space.newproc(self.default_proc)

@classdef.method("[]")
def method_subscript(self, space, w_key):
try:

0 comments on commit 62d233b

Please sign in to comment.
You can’t perform that action at this time.