lib/protocol_buffers/runtime/message.rb in ruby-protocol-buffers-1.2.3.beta1 vs lib/protocol_buffers/runtime/message.rb in ruby-protocol-buffers-1.2.3.beta2
- old
+ new
@@ -207,11 +207,11 @@
# The following Ruby code will be generated:
#
# module Foo
# VALUE_A = 1
# VALUE_B = 5
- # VALUE_C 1234
+ # VALUE_C = 1234
# end
#
# An exception will be thrown if an enum field is assigned a value not in the
# enum. If an unknown enum value is found while parsing a message, this is
# treated like an unknown tag id. This matches the C++ library behavior.
@@ -385,10 +385,15 @@
def inspect
ret = ProtocolBuffers.bin_sio
ret << "#<#{self.class.name}"
fields.each do |tag, field|
- ret << " #{field.name}=#{field.inspect_value(self.__send__(field.name))}"
+ if value_for_tag?(tag)
+ value = field.inspect_value(self.__send__(field.name))
+ else
+ value = "<unset>"
+ end
+ ret << " #{field.name}=#{value}"
end
ret << ">"
return ret.string
end