Sha256: bd7c0bff01039245284c8be0bc9a818aa13b25353aa76a6f1fbf434e1bb4921f
Contents?: true
Size: 816 Bytes
Versions: 16
Compression:
Stored size: 816 Bytes
Contents
require 'protobuf/field/varint_field' module Protobuf module Field class BoolField < VarintField ## # Class Methods # def self.default false end ## # Public Instance Methods # # def acceptable?(val) [true, false].include?(val) end def decode(value) value == 1 end def encode(value) [value ? 1 : 0].pack('C') end private ## # Private Instance Methods # def define_getter super field = self message_class.class_eval do define_method("#{field.getter_method_name}?") do field.warn_if_deprecated @values.fetch(field.name, field.default_value) end end end end end end
Version data entries
16 entries across 16 versions & 2 rubygems