Sha256: d034fae0499f6f5f3b61a88eedc537e9d5ce0456bf93d80c93e1a5d94181a5bb

Contents?: true

Size: 605 Bytes

Versions: 8

Compression:

Stored size: 605 Bytes

Contents

module Github
  class ParamsHash < ::Hash

    def initialize(*args, &block)
      hash = args.extract_options!
      # debugger
      # debugger
      # normalize_keys!(hash)
      # debugger
      super[hash]
    end

    def normalize_keys!(params)
      case params
      when Hash
        params.keys.each do |k|
          params[k.to_s] = params.delete(k)
          normalize_keys!(params[k.to_s])
        end
      when Array
        params.map! do |el|
          normalize_keys!(el)
        end
      else
        params.to_s
      end
      return params
    end

  end # ParamsHash
end # Github

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
github_api-0.9.7 lib/github_api/params_hash.rb
github_api-0.9.6 lib/github_api/params_hash.rb
github_api-0.9.5 lib/github_api/params_hash.rb
github_api-0.9.4 lib/github_api/params_hash.rb
github_api-0.9.3 lib/github_api/params_hash.rb
github_api-0.9.2 lib/github_api/params_hash.rb
github_api-0.9.1 lib/github_api/params_hash.rb
github_api-0.9.0 lib/github_api/params_hash.rb