139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
# File 'lib/protod/proto/part.rb', line 139
def collect_fields
collector = ->(part) do
case part
when Protod::Proto::Package
part.messages.flat_map { collector.call(_1) }
when Protod::Proto::Message
[
*part.fields.flat_map { collector.call(_1) },
*part.messages.flat_map { collector.call(_1) },
]
when Protod::Proto::Oneof
part.fields.flat_map { collector.call(_1) }
when Protod::Proto::Field
[part]
else
[]
end
end
collector.call(self)
end
|