Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add Native::Object#merge!
  • Loading branch information
meh committed Jan 23, 2014
1 parent 79e61db commit 8d72393
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions stdlib/native.rb
Expand Up @@ -193,6 +193,18 @@ def []=(key, value)
end
end

def merge!(other)
%x{
var other = #{Native.convert(other)};
for (var prop in other) {
#@native[prop] = other[prop];
}
}

self
end

def respond_to?(name, include_all = false)
Kernel.instance_method(:respond_to?).bind(self).call(name, include_all)
end
Expand Down

0 comments on commit 8d72393

Please sign in to comment.