Class: Moleculer::Packets::Info::Client

Inherits:
Object
  • Object
show all
Includes:
Support
Defined in:
lib/moleculer/packets/info.rb

Overview

Represents the client information for a given node

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Client

Returns a new instance of Client.



26
27
28
29
30
# File 'lib/moleculer/packets/info.rb', line 26

def initialize(data)
  @type         = HashUtil.fetch(data, :type, nil)
  @version      = HashUtil.fetch(data, :version, nil)
  @lang_version = HashUtil.fetch(data, :lang_version, nil)
end

Instance Attribute Details

#lang_versionObject (readonly)

Returns the value of attribute lang_version.



22
23
24
# File 'lib/moleculer/packets/info.rb', line 22

attr_reader :type,
:version,
:lang_version

#typeString (readonly)

Returns type of client implementation (nodejs, java, ruby etc.).

Returns:

  • (String)

    type of client implementation (nodejs, java, ruby etc.)



22
23
24
# File 'lib/moleculer/packets/info.rb', line 22

def type
  @type
end

#versionString (readonly)

Returns the version of the moleculer client.

Returns:

  • (String)

    the version of the moleculer client



22
23
24
# File 'lib/moleculer/packets/info.rb', line 22

attr_reader :type,
:version,
:lang_version

Instance Method Details

#to_hHash

Returns the object prepared for conversion to JSON for transmission.

Returns:

  • (Hash)

    the object prepared for conversion to JSON for transmission



34
35
36
37
38
39
40
# File 'lib/moleculer/packets/info.rb', line 34

def to_h
  {
    type:        @type,
    version:     @version,
    langVersion: @lang_version,
  }
end