aboutsummaryrefslogtreecommitdiffhomepage
path: root/ruby/lib/google/protobuf/well_known_types.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ruby/lib/google/protobuf/well_known_types.rb')
-rw-r--r--ruby/lib/google/protobuf/well_known_types.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/ruby/lib/google/protobuf/well_known_types.rb b/ruby/lib/google/protobuf/well_known_types.rb
index 3e759591..2ee65bc2 100644
--- a/ruby/lib/google/protobuf/well_known_types.rb
+++ b/ruby/lib/google/protobuf/well_known_types.rb
@@ -155,6 +155,8 @@ module Google
Struct.class_eval do
def [](key)
self.fields[key].to_ruby
+ rescue NoMethodError
+ nil
end
def []=(key, value)
@@ -176,6 +178,10 @@ module Google
hash.each { |key, val| ret[key] = val }
ret
end
+
+ def has_key?(key)
+ self.fields.has_key?(key)
+ end
end
ListValue.class_eval do