Class: MeshChat::Message::NodeListHash

Inherits:
Base
  • Object
show all
Defined in:
lib/meshchat/message/node_list_hash.rb

Instance Attribute Summary

Attributes inherited from Base

#payload, #sender_location, #sender_name, #sender_uid, #time_recieved

Instance Method Summary collapse

Methods inherited from Base

#client, #client_version, #display, #initialize, #render, #type

Constructor Details

This class inherits a constructor from MeshChat::Message::Base

Instance Method Details

#handleNilClass

node list hash is received

Returns:

  • (NilClass)

    no output for this message type



10
11
12
13
# File 'lib/meshchat/message/node_list_hash.rb', line 10

def handle
  respond
  return
end

#messageObject



4
5
6
# File 'lib/meshchat/message/node_list_hash.rb', line 4

def message
  @message ||= Node.as_sha512
end

#respondObject



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/meshchat/message/node_list_hash.rb', line 15

def respond
  if message != Node.as_sha512
    location = payload['sender']['location']

    node = Node.find_by_location(location)

    MeshChat::Net::Client.send(
      node: node,
      message: NodeList.new(message: Node.as_json)
    )
  end
end