Method: Yast::Builtins.listmap
- Defined in:
- src/ruby/yast/builtins.rb
.listmap(list, &block) ⇒ Object
Deprecated.
for mapping of list to hash use various ruby builtins like Hash.[] or Enumerable#reduce
Maps an operation onto all elements of a list and thus creates a map.
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 |
# File 'src/ruby/yast/builtins.rb', line 387 def self.listmap(list, &block) return nil if list.nil? res = ::Hash.new begin Yast.deep_copy(list).each do |i| res.merge! block.call(i) end rescue Yast::Break # break stops adding to hash Yast.y2debug(1, "break in listmap") end res end |