Class: MaplistEntryRem

Inherits:
Object
  • Object
show all
Defined in:
lib/messages/maplist_entry_rem.rb

Overview

MaplistEntryRem

Server -> Client

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash_or_raw) ⇒ MaplistEntryRem

Returns a new instance of MaplistEntryRem.



12
13
14
15
16
17
18
# File 'lib/messages/maplist_entry_rem.rb', line 12

def initialize(hash_or_raw)
  if hash_or_raw.instance_of?(Hash)
    init_hash(hash_or_raw)
  else
    init_raw(hash_or_raw)
  end
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



10
11
12
# File 'lib/messages/maplist_entry_rem.rb', line 10

def name
  @name
end

Instance Method Details

#init_hash(attr) ⇒ Object



25
26
27
# File 'lib/messages/maplist_entry_rem.rb', line 25

def init_hash(attr)
  @name = attr[:name] || 'TODO: fill default'
end

#init_raw(data) ⇒ Object



20
21
22
23
# File 'lib/messages/maplist_entry_rem.rb', line 20

def init_raw(data)
  u = Unpacker.new(data)
  @name = u.get_string(SANITIZE_CC)
end

#to_aObject

basically to_network int array the Server sends to the Client



37
38
39
# File 'lib/messages/maplist_entry_rem.rb', line 37

def to_a
  Packer.pack_str(@name)
end

#to_hObject



29
30
31
32
33
# File 'lib/messages/maplist_entry_rem.rb', line 29

def to_h
  {
    name: @name
  }
end

#to_sObject



41
42
43
# File 'lib/messages/maplist_entry_rem.rb', line 41

def to_s
  to_h
end