Skip to content

Commit

Permalink
Merge pull request #487 from olleolleolle/refactor-to-grep
Browse files Browse the repository at this point in the history
Prefer Enumerable#grep to filter by type
  • Loading branch information
allmarkedup committed Jul 6, 2023
2 parents fe36644 + 59788dc commit c0ed083
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 c0ed083

Please sign in to comment.