Skip to content

Commit 8d72393

Browse files
committedJan 23, 2014
Add Native::Object#merge!
1 parent 79e61db commit 8d72393

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
 

‎stdlib/native.rb

+12
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,18 @@ def []=(key, value)
193193
end
194194
end
195195

196+
def merge!(other)
197+
%x{
198+
var other = #{Native.convert(other)};
199+
200+
for (var prop in other) {
201+
#@native[prop] = other[prop];
202+
}
203+
}
204+
205+
self
206+
end
207+
196208
def respond_to?(name, include_all = false)
197209
Kernel.instance_method(:respond_to?).bind(self).call(name, include_all)
198210
end

0 commit comments

Comments
 (0)
Please sign in to comment.