Skip to content

Commit

Permalink
Add additional Array features to Collection directly
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredcwhite committed Aug 18, 2024
1 parent 4ba3a83 commit 9793325
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion bridgetown-core/lib/bridgetown-core/collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,18 @@ def resources_by_relative_url
resources.group_by(&:relative_url).transform_values(&:first)
end

# Iterate over Resources, support Enumerable
# Iterate over Resources by delegating to `resources.each` (supports Enumerable)
def each(...) = resources.each(...)

# Delgates to `resources.last`
def last(...) = resources.last(...)

# Delgates to `resources.deconstruct`
def deconstruct = resources.deconstruct

# Delgates to `resources[]`
def [](...) = resources.[](...)

# Fetch the static files in this collection.
# Defaults to an empty array if no static files have been read in.
#
Expand Down

0 comments on commit 9793325

Please sign in to comment.