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


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|
    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


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

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