Merge pull request #1613 from xhh/ruby-eql-hash

[Ruby] Add "==", "eql?" and "hash" methods to Ruby client
This commit is contained in:
wing328
2015-11-26 10:29:59 +08:00
12 changed files with 177 additions and 15 deletions

View File

@@ -43,6 +43,19 @@ module {{moduleName}}
@{{{name}}} = {{{name}}}
end
{{/isEnum}}{{/vars}}
def ==(o)
return true if self.equal?(o)
self.class == o.class{{#vars}} &&
{{name}} == o.{{name}}{{/vars}}
end
def eql?(o)
self == o
end
def hash
[{{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}].hash
end
end
{{/model}}
{{/models}}