lib/abstractivator/value_map.rb in abstractivator-0.18.0 vs lib/abstractivator/value_map.rb in abstractivator-0.19.0
- old
+ new
@@ -1,15 +1,12 @@
-# like Enumerable#map, except if the receiver is not enumerable,
+# Like Enumerable#map, except if the receiver is not enumerable,
# i.e., a single value, then it transforms the single value.
+#
+# [2,3].value_map { |x| x * x } => [4, 9]
+# 2 .value_map { |x| x * x } => 4
class Array
alias_method :value_map, :map
-end
-
-class NilClass
- def value_map
- nil
- end
end
class Object
def value_map
yield self