Class: Spree::Support::CoreExtensions::Array::Array

Inherits:
Object
  • Object
show all
Defined in:
lib/spree/support/core_extensions/array.rb

Instance Method Summary collapse

Instance Method Details

#to_hash_keys(&block) ⇒ Object



7
8
9
10
11
# File 'lib/spree/support/core_extensions/array.rb', line 7

def to_hash_keys(&block)
  Hash[*self.collect { |v|
    [v, block.call(v)]
  }.flatten]
end

#to_hash_values(&block) ⇒ Object



13
14
15
16
17
# File 'lib/spree/support/core_extensions/array.rb', line 13

def to_hash_values(&block)
  Hash[*self.collect { |v|
    [block.call(v), v]
  }.flatten]
end