Skip to content

Commit

Permalink
Support Ruby 3+ pattern matching for Collection and Resource::Base
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredcwhite committed Apr 19, 2024
1 parent b1e8541 commit daf1908
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bridgetown-core/lib/bridgetown-core/collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ def resources_by_relative_url
# Iterate over Resources, support Enumerable
def each(...) = resources.each(...)

def deconstruct = resources.deconstruct

# Fetch the static files in this collection.
# Defaults to an empty array if no static files have been read in.
#
Expand Down
4 changes: 4 additions & 0 deletions bridgetown-core/lib/bridgetown-core/resource/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,10 @@ def previous_resource
alias_method :previous_doc, :previous_resource
alias_method :previous, :previous_resource

def deconstruct_keys(...)
@data.value.deconstruct_keys(...)
end

def mark_for_fast_refresh!
@fast_refresh_order = site.fast_refresh_ordering
site.fast_refresh_ordering += 1
Expand Down

0 comments on commit daf1908

Please sign in to comment.