module ModBus::Debug
Attributes
debug[RW]
raise_exception_on_mismatch[RW]
read_retries[RW]
read_retry_timeout[RW]
Private Instance Methods
log(msg)
click to toggle source
Put log message on standart output @param [String] msg message for log
# File lib/rmodbus/debug.rb, line 10 def log(msg) $stdout.puts msg if @debug end
logging_bytes(msg)
click to toggle source
Convert string of byte to string for log @example
logging_bytes("\x1\xa\x8") => "[01][0a][08]"
@param [String] msg input string @return [String] readable string of bytes
# File lib/rmodbus/debug.rb, line 19 def logging_bytes(msg) result = "" msg.each_byte do |c| byte = if c < 16 '0' + c.to_s(16) else c.to_s(16) end result << "[#{byte}]" end result end