Sha256: ae2eaeda056ed6ea911a84e6ebb6d011d7967e79df29e9531f3e230a33daabcd

Contents?: true

Size: 243 Bytes

Versions: 17

Compression:

Stored size: 243 Bytes

Contents

class Hash
  def render_from_yield(&block)
    reduce({}) do |h, entry|
      k, v = entry
      h[block.call(k)] = if v.is_a?(Hash) then
        v.render_from_yield(&block)
      else
        block.call(v)
      end
      h
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
closure_tree-6.6.0 spec/support/hash_monkey_patch.rb
closure_tree-6.5.0 spec/support/hash_monkey_patch.rb
closure_tree-6.4.0 spec/support/hash_monkey_patch.rb
closure_tree-6.3.0 spec/support/hash_monkey_patch.rb
closure_tree-6.2.0 spec/support/hash_monkey_patch.rb
closure_tree-6.1.0 spec/support/hash_monkey_patch.rb
closure_tree-6.0.0 spec/support/hash_monkey_patch.rb
closure_tree-6.0.0.gamma spec/support/hash_monkey_patch.rb
closure_tree-6.0.0.alpha spec/support/hash_monkey_patch.rb
closure_tree-5.2.0 spec/support/hash_monkey_patch.rb
closure_tree-5.1.1 spec/support/hash_monkey_patch.rb
closure_tree-5.1.0 spec/support/hash_monkey_patch.rb
closure_tree-5.0.0 spec/support/hash_monkey_patch.rb
closure_tree-4.6.3 spec/support/hash_monkey_patch.rb
closure_tree-4.6.2 spec/support/hash_monkey_patch.rb
closure_tree-4.6.1 spec/support/hash_monkey_patch.rb
closure_tree-4.6.0 spec/support/hash_monkey_patch.rb