Sha256: cd0a143ef6222eb3ba099545edf2c19bfc5152d1b13caa55b08c4c4b425cbd41

Contents?: true

Size: 670 Bytes

Versions: 1

Compression:

Stored size: 670 Bytes

Contents

require 'json'
require 'pretty_table'
# Alertlogic Helper
module AlertlogicHelper
  # Common Helper
  module Common
    def parse_json(json)
      return JSON.parse(json)
    rescue TypeError, JSON::ParserError
      return t('error.json_parse')
    end

    def pretty_json(json)
      JSON.pretty_generate(json)
    end

    def build_table(data, headers)
      PrettyTable.new(data, headers).to_s
    end

    def check_msg_size?(string)
      string.length >= 9_500 && string.length <= 10_000
    end

    def search?(key, name, hash)
      hash[key].downcase.include? name.downcase
    end

    def valid_uuid?(string)
      UUID.validate(string)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lita-alertlogic-0.0.1 lib/alertlogic_helper/common.rb