Module: Meshtastic::Portnums

Defined in:
lib/meshtastic/portnums.rb

Class Method Summary collapse

Class Method Details

.authorsObject



16
17
18
# File 'lib/meshtastic/portnums.rb', line 16

public_class_method def self.authors
  "AUTHOR(S):\n        0day Inc. <[email protected]>\n      "
end

.helpObject



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/meshtastic/portnums.rb', line 20

public_class_method def self.help
  puts "        USAGE:
    # Run the lookup class method for this module.
    #{self}.lookup(
      value: 'optional - value for value passed into lookup',
      name_or_number: 'optional - value for name_or_number passed into lookup'
    )

    # Run the authors class method for this module.
    #{self}.authors

  "
end

.lookup(opts = {}) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/meshtastic/portnums.rb', line 7

public_class_method def self.lookup(opts = {})
  name_or_number = opts[:value] || opts[:name_or_number]
  if name_or_number.is_a?(Integer)
    Meshtastic::PortNum.lookup(name_or_number)
  else
    Meshtastic::PortNum.resolve(name_or_number.to_sym)
  end
end