Sha256: 33120090e1c09d4c2a9a4a9a4390513a26c2d945cc0d122a0e7005fba3418984

Contents?: true

Size: 665 Bytes

Versions: 6

Compression:

Stored size: 665 Bytes

Contents

# frozen_string_literal: true

module SidekiqUniqueJobs
  # Handles loading and dumping of json
  #
  # @author Mikael Henriksson <mikael@mhenrixon.com>
  module JSON
    module_function

    #
    # Parses a JSON string into an object
    #
    # @param [String] string the object to parse
    #
    # @return [Object]
    #
    def load_json(string)
      return unless string && !string.empty?

      ::JSON.parse(string)
    end

    #
    # Dumps an object into a JSON string
    #
    # @param [Object] object a JSON convertible object
    #
    # @return [String] a JSON string
    #
    def dump_json(object)
      ::JSON.generate(object)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sidekiq-unique-jobs-7.0.1 lib/sidekiq_unique_jobs/json.rb
sidekiq-unique-jobs-7.0.0 lib/sidekiq_unique_jobs/json.rb
sidekiq-unique-jobs-7.0.0.beta29 lib/sidekiq_unique_jobs/json.rb
sidekiq-unique-jobs-7.0.0.beta28 lib/sidekiq_unique_jobs/json.rb
sidekiq-unique-jobs-7.0.0.beta27 lib/sidekiq_unique_jobs/json.rb
sidekiq-unique-jobs-7.0.0.beta26 lib/sidekiq_unique_jobs/json.rb