enumerated_type
enumerated_type copied to clipboard
Coercing a collection
I find myself adding collection coercion frequently:
def coerce(values)
values.respond_to?(:map) ? values.map { |value| super(value) } : super(values)
end
or
def coerce(values)
values.is_a?(Enumerable) ? values.map { |value| super(value) } : super(values)
end
Bad idea to include this out-of-the-box?
@BenEddy @rafer could we get some resolution here?
Closed due to universal unpopularity.