Class: ProcessCommand::Signal::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/process_command/signal/command.rb

Class Method Summary collapse

Class Method Details

.i2s(command) ⇒ Object



7
8
9
# File 'lib/process_command/signal/command.rb', line 7

def self.i2s(command)
  command.to_s(16).scan(/.{2}/).map{|c| c.to_i(16).chr}.join
end

.s2i(command) ⇒ Object



11
12
13
# File 'lib/process_command/signal/command.rb', line 11

def self.s2i(command)
  command.to_s.each_char.map{|c| c.ord.to_s(16)}.join.to_i(16)
end