Sha256: 5304df8368e4b113d9bd118961152305bfcae454fbd103f701e642ef6978d027

Contents?: true

Size: 661 Bytes

Versions: 1

Compression:

Stored size: 661 Bytes

Contents

module Polyfill
  module V2_3
    module Hash
      module Instance
        module FetchValues
          module Method
            def fetch_values(*keys)
              keys.each_with_object([]) do |key, values|
                value =
                  if block_given?
                    fetch(key, &::Proc.new)
                  else
                    fetch(key)
                  end

                values << value
              end
            end
          end

          refine ::Hash do
            include Method
          end

          def self.included(base)
            base.include Method
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
polyfill-0.6.0 lib/polyfill/v2_3/hash/instance/fetch_values.rb