Sha256: 28730e476841e6d4927555e852a8df8c6cb4a4347fb550e5e42501ab8acd20e0

Contents?: true

Size: 375 Bytes

Versions: 3

Compression:

Stored size: 375 Bytes

Contents

module ApipieBindings

  module Utilities

    def self.params_hash_tree(params_hash, &block)
      block ||= lambda { |_| true }
      params_hash.inject([]) do |tree, par|
        if block.call(par)
          subtree = par.expected_type == :hash ? { par.name => par.tree(&block) } : par.name
          tree << subtree
        end
        tree
      end
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
apipie-bindings-0.0.12 lib/apipie_bindings/utilities.rb
apipie-bindings-0.0.11 lib/apipie_bindings/utilities.rb
apipie-bindings-0.0.10 lib/apipie_bindings/utilities.rb