Loving 2.4 so far! Today I ran into an issue with the keyword args option for lambdas:
Using this per the blog example:
property :team_id,
as: :teamId,
setter: ->(fragment:, doc:) { puts "#{fragment}" }
...raises the following exception:
ArgumentError: ArgumentError: unknown keywords: options, represented, decorator, binding, input, as, user_options
If I add more keyword args (e.g. decorator:), that arg disappears from the error list. Likewise if I take keyword args away, they appear in the error list. It seems as if I'm being expected to either pass a singular variable 'options' or every single keyword possible variable.
Using options:
property :team_id,
as: :teamId,
setter: ->(options) { puts options[:doc] }
...works without raising any exceptions.
So far I've had to resort to the old positional args to get the desired behavior:
property :team,
as: :teamId,
setter: ->(val, *) do
self.team = team_model.stats_find(val)
end
Loving 2.4 so far! Today I ran into an issue with the keyword args option for lambdas:
Using this per the blog example:
...raises the following exception:
If I add more keyword args (e.g.
decorator:), that arg disappears from the error list. Likewise if I take keyword args away, they appear in the error list. It seems as if I'm being expected to either pass a singular variable 'options' or every single keyword possible variable.Using
options:...works without raising any exceptions.
So far I've had to resort to the old positional args to get the desired behavior: