Sha256: 66d594f77f7343944e62042f6bab0c6210359b23f5622cfd17ef345c0a8cd5ae

Contents?: true

Size: 280 Bytes

Versions: 6

Compression:

Stored size: 280 Bytes

Contents

# like Enumerable#map, except if the receiver is not enumerable,
# i.e., a single value, then it transforms the single value.

class Array
  alias_method :value_map, :map
end

class NilClass
  def value_map
    nil
  end
end

class Object
  def value_map
    yield self
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
abstractivator-0.18.0 lib/abstractivator/value_map.rb
abstractivator-0.17.0 lib/abstractivator/value_map.rb
abstractivator-0.16.0 lib/abstractivator/value_map.rb
abstractivator-0.15.0 lib/abstractivator/value_map.rb
abstractivator-0.14.0 lib/abstractivator/value_map.rb
abstractivator-0.13.0 lib/abstractivator/value_map.rb