Module: ProtoRecord

Extended by:
ActiveSupport::Concern
Defined in:
lib/proto_record.rb,
lib/proto_record/errors.rb,
lib/proto_record/version.rb,
lib/proto_record/proto_record.rb

Defined Under Namespace

Classes: MissingFieldsResolver, MissingProtoMessage

Constant Summary collapse

VERSION =
"0.1.0"

Instance Method Summary collapse

Instance Method Details

#to_protoObject



33
34
35
36
37
38
39
# File 'lib/proto_record/proto_record.rb', line 33

def to_proto
  raise MissingProtoMessage, self.class.name if proto_message.nil?

  message_args = is_a?(ActiveRecord::Base) ? resolve_active_record_object : resolve_class_object

  proto_message.new(message_args)
end