Module: Protod::Interpreter::ProtoMessageCacheable

Defined in:
lib/protod/interpreter.rb

Instance Method Summary collapse

Instance Method Details

#proto_messageObject



99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/protod/interpreter.rb', line 99

def proto_message
  if @_proto_message.nil?
    @_proto_message = super&.tap do |m|
      next if const.ancestors.any? { _1.in?([Protod::Rpc::Request::Base, Protod::Rpc::Response::Base]) }

      m.fields.unshift(Protod::Proto::Field.build_from('::String', ident: 'protod__object_id', optional: true))
    end

    @_proto_message = false unless @_proto_message
  end

  @_proto_message ? @_proto_message : nil
end