Sha256: d7c3e80e24c9dec5f1f9a012e5e7eafad35ff9492d6c75820ac8ebd813c06cc1

Contents?: true

Size: 322 Bytes

Versions: 4

Compression:

Stored size: 322 Bytes

Contents

module FreshdeskAPI
  # @private
  module Helpers
    def self.deep_hash_access(hash, path)
      path.split('/').each do |p|
        if p.to_i.to_s == p
          hash = hash[p.to_i]
        else
          hash = hash[p.to_s] || hash[p.to_sym]
        end
        break unless hash
      end
      hash
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
freshdesk_api-0.1.3 lib/freshdesk_api/helpers.rb
freshdesk_api-0.1.2 lib/freshdesk_api/helpers.rb
freshdesk_api-0.1.1 lib/freshdesk_api/helpers.rb
freshdesk_api-0.1.0 lib/freshdesk_api/helpers.rb