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

.hash_deep_dup(hash) ⇒ Object

borrowed from Rails 3.2 ActiveSupport



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

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

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

  duplicate
end

.included(base) ⇒ Object



5
6
7
# File 'lib/httparty/module_inheritable_attributes.rb', line 5

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