- Add nested processors support. (@palkan)
-
Add
filter_with: Symbol | Proc
option to.map
to allowing filtering the input value. (@palkan) -
Allow specifying
ignore_empty_values: *
per rule. (@palkan) -
Add
prepare
DSL method to transform the input once before the first rule is activated. (@palkan)
When no rules match, the method is not called. Useful when you want to perform some default transformations.
- Fix bug with trying to add a helper for API controller. (@palkan)
Fixes #10.
- Add
Process.project
andrubanok_scope
methods to get the Hash of recognized params. (@palkan)
class PostsProcessor < Rubanok::Processor
map(:q) { block }
match(:page, :per_page, activate_on: :page) { block }
end
PostsProcessor.project(q: "search_me", filter: "smth", page: 2)
# => { q: "search_me", page: 2 }
class PostsController < ApplicationController
def index
@filter_params = rubanok_scope
# or
@filter_params = rubanok_scope params.require(:filter), with: PostsProcessor
# ...
end
end
- Improve naming by using "processor" instead of "plane". (@palkan)
See the discussion.
NOTE: Older API is still available without deprecation.
- Add
fail_when_no_matches
parameter tomatch
method. (@Earendil95)
- Fix using
activate_always: true
withdefault
matching clause. (@palkan)
- Fix RSpec matcher to call original implementation instead of returning
nil
. (@palkan)
Initial implementation.
Proposal added.