Module: HTTParty::ModuleInheritableAttributes

Defined in:
lib/httparty/module_inheritable_attributes.rb

Overview

:nodoc:

Defined Under Namespace

Modules: ClassMethods

Class Method Summary (collapse)

Class Method Details

+ (Object) hash_deep_dup(hash)

borrowed from Rails 3.2 ActiveSupport



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/httparty/module_inheritable_attributes.rb', line 8

def self.hash_deep_dup(hash)
  duplicate = hash.dup

  duplicate.each_pair do |key, value|
    duplicate[key] = if value.is_a?(Hash)
      hash_deep_dup(value)
    elsif value.is_a?(Proc)
      duplicate[key] = value.dup
    else
      value
    end
  end

  duplicate
end

+ (Object) included(base)



3
4
5
# File 'lib/httparty/module_inheritable_attributes.rb', line 3

def self.included(base)
  base.extend(ClassMethods)
end