lib/cocoa/sugarcube-spritekit/sknode.rb in sugarcube-2.10.0 vs lib/cocoa/sugarcube-spritekit/sknode.rb in sugarcube-2.11.0

- old
+ new

@@ -7,14 +7,25 @@ def run_action(action, &completion) runAction(action, completion: completion) end def [](key) - userData[key] + self.userData ||= {} + userData[key.to_s] end def []=(key, value) - userData[key] = value + self.userData ||= {} + userData[key.to_s] = value + end + + def each_named(name, &block) + if block.arity == 1 + using_block = -> (node, stop_ptr) { block.call(node) } + else + using_block = block + end + enumerateChildNodesWithName(name, usingBlock: using_block) end def to_s "#<#{self.class}:0x#{self.object_id.to_s(16)} position=#{position.inspect} name=#{name.inspect}>" end