Sha256: 3e48389ee81639573c1b02616e458199d023e3e208e7226095ae8d2249a34976

Contents?: true

Size: 551 Bytes

Versions: 7

Compression:

Stored size: 551 Bytes

Contents

#!/usr/bin/env ruby

require 'oj'

module Flapjack

  DEFAULT_INITIAL_FAILURE_DELAY = 30
  DEFAULT_REPEAT_FAILURE_DELAY  = 60

  def self.load_json(data)
    Oj.load(data, :mode => :strict, :symbol_keys => false)
  end

  def self.dump_json(data)
    Oj.dump(data, :mode => :compat, :time_format => :ruby, :indent => 0)
  end

  def self.sanitize(str)
    return str if str.nil? || !str.is_a?(String) || str.valid_encoding?
    return str.scrub('?') if str.respond_to?(:scrub)
    str.chars.collect {|c| c.valid_encoding? ? c : '?' }.join
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
flapjack-1.6.0 lib/flapjack.rb
flapjack-1.6.0rc4 lib/flapjack.rb
flapjack-1.6.0rc3 lib/flapjack.rb
flapjack-1.6.0rc2 lib/flapjack.rb
flapjack-1.6.0rc1 lib/flapjack.rb
flapjack-1.5.0 lib/flapjack.rb
flapjack-1.5.0rc1 lib/flapjack.rb