Sha256: dc33d485596ce43f8b90d603b680369f70de9e7d7d2a98335404e88919052456

Contents?: true

Size: 332 Bytes

Versions: 31

Compression:

Stored size: 332 Bytes

Contents

def flatten_keys_to_joined_string(h, key_delim='::')
  flat = {}
  h.each_pair do |k, v|
    if v.respond_to?(:keys)
      flatten_keys_to_joined_string(v, key_delim).each_pair do |k2, v2|
        flat.merge!({[k.to_s, k2.to_s].join(key_delim) => v2})
      end
    else
      flat.merge!({ k.to_s => v })
    end
  end

  flat
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
beaker-answers-1.0.0 lib/beaker-answers/helpers.rb
beaker-answers-0.29.0 lib/beaker-answers/helpers.rb
beaker-answers-0.28.0 lib/beaker-answers/helpers.rb
beaker-answers-0.27.0 lib/beaker-answers/helpers.rb
beaker-answers-0.26.3 lib/beaker-answers/helpers.rb
beaker-answers-0.26.2 lib/beaker-answers/helpers.rb
beaker-answers-0.26.1 lib/beaker-answers/helpers.rb
beaker-answers-0.26.0 lib/beaker-answers/helpers.rb
beaker-answers-0.25.0 lib/beaker-answers/helpers.rb
beaker-answers-0.24.0 lib/beaker-answers/helpers.rb
beaker-answers-0.23.0 lib/beaker-answers/helpers.rb
beaker-answers-0.22.0 lib/beaker-answers/helpers.rb
beaker-answers-0.21.0 lib/beaker-answers/helpers.rb
beaker-answers-0.20.0 lib/beaker-answers/helpers.rb
beaker-answers-0.19.0 lib/beaker-answers/helpers.rb
beaker-answers-0.18.0 lib/beaker-answers/helpers.rb
beaker-answers-0.17.0 lib/beaker-answers/helpers.rb
beaker-answers-0.16.0 lib/beaker-answers/helpers.rb
beaker-answers-0.15.0 lib/beaker-answers/helpers.rb
beaker-answers-0.14.0 lib/beaker-answers/helpers.rb