Skip to content

Commit

Permalink
Bump version to 3.69.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyevans committed Jun 13, 2023
1 parent 58c6e89 commit ba08c96
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= master
= 3.69.0 (2023-06-13)

* Allow symbol_matcher in symbol_matchers plugin to take a block to allow type conversion (jeremyevans)

Expand Down
33 changes: 33 additions & 0 deletions doc/release_notes/3.69.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
= New Feature

* The symbol_matcher method in the symbol_matchers plugin now
supports a block to allow for type conversion of matched
segments:

symbol_matcher(:date, /(\d\d\d\d)-(\d\d)-(\d\d)/) do |y, m, d|
[Date.new(y.to_i, m.to_i, d.to_i)]
end

route do |r|
r.on :date do |date|
# date is an instance of Date
end
end

As shown above, the block should return an array of objects to yield
to the match block.

If you have a segment match the passed regexp, but decide during block
processing that you do not want to treat it as a match, you can have the
block return nil or false. This is useful if you want to make sure you
are using valid data:

symbol_matcher(:date, /(\d\d\d\d)-(\d\d)-(\d\d)/) do |y, m, d|
y = y.to_i
m = m.to_i
d = d.to_i
[Date.new(y, m, d)] if Date.valid_date?(y, m, d)
end

When providing a block when using the symbol_matchers method, that
symbol may not work with the params_capturing plugin.
2 changes: 1 addition & 1 deletion lib/roda/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Roda
RodaMajorVersion = 3

# The minor version of Roda, updated for new feature releases of Roda.
RodaMinorVersion = 68
RodaMinorVersion = 69

# The patch version of Roda, updated only for bug fixes from the last
# feature release.
Expand Down

0 comments on commit ba08c96

Please sign in to comment.