class Protobuf::EnumValue
def class
def class Fixnum end
def initialize(parent_class, name, value)
Constructor
#
def initialize(parent_class, name, value) @parent_class = parent_class @name = name @value = value super(@value) end
def inspect
def inspect "\#<Protobuf::EnumValue #{@parent_class}::#{@name}=#{@value}>" end
def to_i
def to_i @value end
def to_int
def to_int @value.to_int end
def to_s(format = :value_string)
def to_s(format = :value_string) case format when :value_string then self.to_i.to_s when :name then name.to_s else self.to_i.to_s end end
def try(*args, &block)
delegate the `try` call to the underlying vlaue fixnum.
If we respond to the first argument, `__send__` the args. Otherwise,
the underlying fixnum doesn't respond to all methods (e.g. name or value).
Re-implement `try` in order to fix the problem where
def try(*args, &block) case when args.empty? && block_given? yield self when respond_to?(args.first) __send__(*args, &block) else @value.try(*args, &block) end end
def value
def value @value end