Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
src/sources.rb

Instance Method Summary collapse

Instance Method Details

#gsub_s(r, s) ⇒ Object



26
# File 'src/sources.rb', line 26

def gsub_s(r, s) = gsub_s_(self, r, s)

#gsub_s_(h, r, s) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'src/sources.rb', line 28

def gsub_s_(h, r, s)
  (h.is_a?(Hash) ? h.transform_values : h.map).each do |v|
    case
    when v.is_a?(String); v.gsub(r,s)
    when v.is_a?(Hash); gsub_s_(v, r, s)
    else v
    end
  end
end