Class: Array::HashBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/array/hash_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(values, keys) ⇒ HashBuilder

Returns a new instance of HashBuilder.



4
5
6
7
# File 'lib/array/hash_builder.rb', line 4

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

Instance Attribute Details

#keysObject

Returns the value of attribute keys.



2
3
4
# File 'lib/array/hash_builder.rb', line 2

def keys
  @keys
end

#valuesObject

Returns the value of attribute values.



2
3
4
# File 'lib/array/hash_builder.rb', line 2

def values
  @values
end

Instance Method Details

#buildObject



9
10
11
12
13
# File 'lib/array/hash_builder.rb', line 9

def build
  fixes_sizes

  Hash[[keys, values].transpose]
end