ruby-protobuf / protobuf

A pure ruby implementation of Google's Protocol Buffers
https://github.com/ruby-protobuf
MIT License
463 stars 101 forks source link

Fix enum's to_json #386

Closed drcapulet closed 6 years ago

drcapulet commented 6 years ago

This PR fixes two regressions from #385.

First, to_json needs to return a string:

irb(main):003:0> 5.to_json
=> "5"

Second, when using JSON.dump, to_json is expected to take a JSON::State argument - see ActiveSupport's comment here.

film42 commented 6 years ago

Thanks @drcapulet ! I'll look at the to_i stuff later.