Class: Protobuf::Field::EnumField

Inherits:
VarintField show all
Defined in:
lib/protobuf/message/field.rb

Constant Summary

Constants inherited from VarintField

VarintField::INT32_MAX, VarintField::INT32_MIN, VarintField::INT64_MAX, VarintField::INT64_MIN, VarintField::UINT32_MAX, VarintField::UINT64_MAX

Instance Attribute Summary

Attributes inherited from BaseField

#message_class, #name, #rule, #tag, #type

Instance Method Summary collapse

Methods inherited from VarintField

#decode, decode, default, encode, #encode, #wire_type

Methods inherited from BaseField

#clear, default, #default_value, descriptor, #descriptor, #error_message, #get, #initialize, #initialized?, #max, #merge, #merge_array, #merge_value, #min, #optional?, #ready?, #repeated?, #required?, #set, #to_s, #typed_default_value

Constructor Details

This class inherits a constructor from Protobuf::Field::BaseField

Instance Method Details

#acceptable?(val) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (TypeError)


615
616
617
618
# File 'lib/protobuf/message/field.rb', line 615

def acceptable?(val)
  raise TypeError unless type.valid_tag? val
  true
end

#defaultObject



607
608
609
610
611
612
613
# File 'lib/protobuf/message/field.rb', line 607

def default
  if @default.is_a?(Symbol)
    type.const_get @default
  else
    @default
  end
end