module AlertlogicHelper::Common
Common
Helper
Public Instance Methods
build_table(data, headers)
click to toggle source
# File lib/alertlogic_helper/common.rb, line 17 def build_table(data, headers) PrettyTable.new(data, headers).to_s end
check_msg_size?(string)
click to toggle source
# File lib/alertlogic_helper/common.rb, line 21 def check_msg_size?(string) string.length >= 9_500 && string.length <= 10_000 end
parse_json(json)
click to toggle source
# File lib/alertlogic_helper/common.rb, line 7 def parse_json(json) return JSON.parse(json) rescue TypeError, JSON::ParserError return t('error.json_parse') end
pretty_json(json)
click to toggle source
# File lib/alertlogic_helper/common.rb, line 13 def pretty_json(json) JSON.pretty_generate(json) end
search?(key, name, hash)
click to toggle source
# File lib/alertlogic_helper/common.rb, line 25 def search?(key, name, hash) hash[key].downcase.include? name.downcase end
valid_uuid?(string)
click to toggle source
# File lib/alertlogic_helper/common.rb, line 29 def valid_uuid?(string) UUID.validate(string) end