Skip to content

Commit

Permalink
Prefer Enumerable#grep to filter by type
Browse files Browse the repository at this point in the history
  • Loading branch information
olleolleolle committed Jun 12, 2023
1 parent fe36644 commit 59788dc
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/lookbook/entities/collections/preview_collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ def remove_by_file_path(paths)
end

def entities
@_cache[:entities] ||= begin
all = collect_ordered_entities(to_tree(include_hidden: true))
all.filter { _1.is_a?(Lookbook::PreviewEntity) }
end
@_cache[:entities] ||= collect_ordered_entities(to_tree(include_hidden: true)).grep(Lookbook::PreviewEntity)
end

class << self
Expand Down

0 comments on commit 59788dc

Please sign in to comment.