module ConnectProto::Extensions::Valueable

Public Class Methods

to_value(value) click to toggle source
# File lib/extensions/valueable.rb, line 6
def self.to_value(value)
  case value
  when String then Google::Protobuf::Value.new(string_value: value)
  when Numeric then Google::Protobuf::Value.new(number_value: value)
  when NilClass then Google::Protobuf::Value.new(null_value: :NULL_VALUE)
  else
    raise TypeError, "Invalid type #{value.class} for value #{value}"
  end
end