Class: Waistband::StringifiedHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/waistband/stringified_hash.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.new_from(original) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/waistband/stringified_hash.rb', line 6

def new_from(original)
  copy = new
  original.each do |k, v|
    copy[k] = v
  end
  copy
end

Instance Method Details

#stringify_allObject



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/waistband/stringified_hash.rb', line 16

def stringify_all
  stringified = {}

  each do |key, val|
    if val.respond_to?(:to_s)
      stringified[key] = val.to_s
    else
      stringified[key] = val
    end
  end

  stringified
end