Class: Protopuffs::Embedded
- Inherits:
-
LengthDelimited
- Object
- MessageField
- LengthDelimited
- Protopuffs::Embedded
- Defined in:
- lib/protopuffs/message/field.rb
Instance Attribute Summary
Attributes inherited from MessageField
Class Method Summary collapse
Instance Method Summary collapse
- #decode(bytes) ⇒ Object
-
#initialize(type, modifier, identifier, tag, default = nil) ⇒ Embedded
constructor
A new instance of Embedded.
Methods inherited from LengthDelimited
Methods inherited from MessageField
factory, #key, #optional?, #repeated?, shift_tag, #to_wire_format_with_value
Constructor Details
#initialize(type, modifier, identifier, tag, default = nil) ⇒ Embedded
Returns a new instance of Embedded.
210 211 212 213 |
# File 'lib/protopuffs/message/field.rb', line 210 def initialize(type, modifier, identifier, tag, default = nil) @type = type super(modifier, identifier, tag, default) end |
Class Method Details
Instance Method Details
#decode(bytes) ⇒ Object
214 215 216 217 218 |
# File 'lib/protopuffs/message/field.rb', line 214 def decode(bytes) bytes.force_encoding("BINARY") if bytes.respond_to?(:force_encoding) value = Message.const_get(@type.delete("_")).new value.from_wire_format(StringIO.new(bytes)) end |