lib/jinx/helpers/flattener.rb in jinx-2.1.3 vs lib/jinx/helpers/flattener.rb in jinx-2.1.4
- old
+ new
@@ -1,11 +1,11 @@
module Jinx
# A Flattener applies a given block to flattened collection content.
class Flattener
- include Collection
+ include Enumerable, Collection
# Visits the enumerated items in the given object's flattened content.
- # block is called on the base itself if the base is neither nil nor a Enumerable.
+ # The given block is called on the base itself if the base is neither nil nor a Enumerable.
# If the base object is nil or empty, then this method is a no-op and returns nil.
def self.on(obj, &block)
obj.collection? ? obj.each { |item| on(item, &block) } : yield(obj) unless obj.nil?
end
\ No newline at end of file