Module: Takumi::Packet::Dsl::ClassMethods

Defined in:
lib/takumi/packet/dsl.rb

Instance Method Summary collapse

Instance Method Details

#decode(packet) ⇒ Object



17
18
19
20
# File 'lib/takumi/packet/dsl.rb', line 17

def decode(packet)
  attrs = ::Takumi::Packet.decode(self, packet)
  new(attrs)
end

#field(name, type) ⇒ Object



9
10
11
# File 'lib/takumi/packet/dsl.rb', line 9

def field(name, type)
  fields << {name: name, type: type}
end

#fieldsObject



13
14
15
# File 'lib/takumi/packet/dsl.rb', line 13

def fields
  @fields ||= []
end