class RubyNos::Formatter

Public Class Methods

timestamp() click to toggle source
# File lib/ruby_nos/formatter.rb, line 21
def self.timestamp
  (Time.now.to_f*1000).to_i
end

Public Instance Methods

convert_to_uuid(string_uuid) click to toggle source
# File lib/ruby_nos/formatter.rb, line 5
def convert_to_uuid string_uuid
  string_uuid.match(/(\h{8})(\h{4})(\h{4})(\h{4})(\h{12})/).captures.join("-")
end
parse_message(message) click to toggle source
# File lib/ruby_nos/formatter.rb, line 17
def parse_message message
  JSON.parse(message, {symbolize_names: true})
end
uuid_format?(uuid) click to toggle source
# File lib/ruby_nos/formatter.rb, line 9
def uuid_format? uuid
  !!uuid.match(/\h{8}-\h{4}-\h{4}-\h{4}-\h{12}/)
end
uuid_to_string(uuid) click to toggle source
# File lib/ruby_nos/formatter.rb, line 13
def uuid_to_string uuid
  uuid.gsub("-", "")
end