Sha256: 42c34156f2020a6ac4a04769a43a55e1131e12b0397a51d949f0b46b907db99c

Contents?: true

Size: 331 Bytes

Versions: 20

Compression:

Stored size: 331 Bytes

Contents

class Array::HashBuilder
  attr_accessor :values, :keys

  def initialize(values, keys)
    @values = values.dup
    @keys = keys.dup
  end

  def build
    fixes_sizes

    Hash[[keys, values].transpose]
  end

  private

  def fixes_sizes
    values.concat Array.new(keys.size - values.size) if keys.size > values.size
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
darthjee-core_ext-1.5.6 lib/darthjee/core_ext/array/hash_builder.rb
darthjee-core_ext-1.5.5 lib/darthjee/core_ext/array/hash_builder.rb
darthjee-core_ext-1.5.4 lib/darthjee/core_ext/array/hash_builder.rb
darthjee-core_ext-1.5.3 lib/darthjee/core_ext/array/hash_builder.rb
darthjee-core_ext-1.5.2 lib/darthjee/core_ext/array/hash_builder.rb
darthjee-core_ext-1.5.1 lib/darthjee/core_ext/array/hash_builder.rb
darthjee-core_ext-1.5.0 lib/darthjee/core_ext/array/hash_builder.rb
darthjee-core_ext-1.4.1 lib/darthjee/core_ext/array/hash_builder.rb
darthjee-core_ext-1.4.0 lib/darthjee/core_ext/array/hash_builder.rb
darthjee-core_ext-1.3.1 lib/array/hash_builder.rb
darthjee-core_ext-1.3.0 lib/array/hash_builder.rb
darthjee-core_ext-1.2.6 lib/array/hash_builder.rb
bidu-core_ext-1.2.5 lib/array/hash_builder.rb
bidu-core_ext-1.2.4 lib/array/hash_builder.rb
bidu-core_ext-1.2.3 lib/array/hash_builder.rb
bidu-core_ext-1.2.2 lib/array/hash_builder.rb
bidu-core_ext-1.2.1 lib/array/hash_builder.rb
bidu-core_ext-1.2.0 lib/array/hash_builder.rb
bidu-core_ext-1.1.1 lib/array/hash_builder.rb
bidu-core_ext-1.0.0 lib/array/hash_builder.rb