lib/micro_micro/collections/items_collection.rb in micromicro-4.0.0 vs lib/micro_micro/collections/items_collection.rb in micromicro-5.0.0
- old
+ new
@@ -56,11 +56,11 @@
#
# @see MicroMicro::Item#types
#
# @return [Array<String>]
def types
- @types ||= flat_map(&:types).uniq.sort
+ @types ||= Set[*flat_map(&:types)].to_a.sort
end
# Recursively search this collection for {MicroMicro::Item}s matching the
# given conditions.
#
@@ -68,22 +68,22 @@
# {MicroMicro::Item}s matching _all_ conditions. Keys must be Symbols
# matching an instance method on {MicroMicro::Item} and values may be
# either a String or an Array of Strings.
#
# @example Search using a Hash with a String value
- # MicroMicro.parse(markup, url).items.where(types: 'h-card')
+ # MicroMicro.parse(markup, url).items.where(types: "h-card")
#
# @example Search using a Hash with an Array value
- # MicroMicro.parse(markup, url).items.where(types: ['h-card', 'h-entry'])
+ # MicroMicro.parse(markup, url).items.where(types: ["h-card", "h-entry"])
#
# When passing a block, each {MicroMicro::Item} in this collection is
# yielded to the block and the returned collection will include
# {MicroMicro::Item}s that cause the block to return a value other than
# +false+ or +nil+.
#
# @example Search using a block
# MicroMicro.parse(markup, url).items.where do |item|
- # item.properties.names.include?('email')
+ # item.properties.names.include?("email")
# end
#
# @param args [Hash{Symbol => String, Array<String>}]
# @yieldparam item [MicroMicro::Item]
# @return [MicroMicro::Collections::ItemsCollection]