Closed embark closed 8 years ago
Tests will fail until #315 is merged
@zanker @zachmargolis care to review?
At least code wise it looks sane, I don't have a lot of context on the protobuf specifics though.
LG. KEEP UP THE GOOD WORK
Ping @film42 @liveh2o . Tests expected to fail until my other PR is merged, sorry about that
Just merged #315
Let's get this branch cleaned up and I think it should be good to go.
What have I done to rubocop :/
@film42 sorry for the delay, fixed rubocop errors by disabling the broken cop
@film42 bump :)
Hey so I know this is late in the life of this PR but I think we can clean up he markup by a lot, and not have to include that inject
line if we use the Class#inherited hook
So instead of having
class Message < Protobuf::Message
Protobuf::Optionable.inject(self)
end
We can define #inherited
on the Message class:
class Protobuf::Message
def self.inherited(subklass)
Protobuf::Optionable.inject(subklass)
end
end
Which has the same net effect and cleans up the result. WDYT?
@zachmargolis If I understand what you're saying, I don't think that's going to work the way you want. We're actually injecting FileOptions
on every inner module
that we get from the package name only (none of which extend anything). For example:
module Google
module Protobuf
::Protobuf::Optionable.inject(self) { ::Google::Protobuf::FileOptions }
The Protobuf::Message
inject is already inherited by default with this code:
module Protobuf
class Message
::Protobuf::Optionable.inject(self) { ::Google::Protobuf::MessageOptions }
@embark oh you are right I completely misunderstood, thx for explaining
@film42 @nerdrew changed the require logic structure, makes things ultimately more simple I think. Let me know what you think
ping @film42 @liveh2o for review :)
Thanks for the ping @embark ! :shipit: 🎉
Also, thanks for your patience :)
I probably won't be able to cut a pre until tonight, but I'll set a reminder so I don't forget!
Thanks! Please give it another look before you merge
Released as 3.7.0.pre1
!
In prep for adding support for custom field, enum, message, file, service, and method options
CC @nerdrew @film42 @liveh2o
Re: requires
get_option
needs Google::Protobuf::_Options to work (Optionable takes a Google::Protobuf::_Options class as an argument), so descriptor.pb needs to get required before usingget_option
.BUT, to parse descriptor.pb, Protobuf::{Enum,Message,etc} needs to exist. So, require protobuf/message, then require descriptor.pb
get_option! -> return explicitly set options only