discourse/lib/service
Loïc Guitaut 9e9abe0a82 DEV: Unify params access in services
Currently, there are two ways (kind of) for accessing `params` inside a
service:
- when there is no contract or it hasn’t been reached yet, `params` is
  just the hash that was provided to the service. To access a key, you
  have to use the bracket notation `params[:my_key]`.
- when there is a contract and it has been executed successfully,
  `params` now references the contract and the attributes are accessible
  using methods (`params.my_key`).

This patch unifies how `params` exposes its attributes. Now, even if
there is no contract at all in a service, `params` will expose its
attributes through methods, that way things are more consistent.

This patch also makes sure there is always a `params` object available
even when no `params` key is provided to the service (this allows a
contract to fail because its attributes are blank instead of having the
service raising an error because it doesn’t find `params` in its context).
2024-12-13 11:13:18 +01:00
..
action_base.rb
base.rb DEV: Unify params access in services 2024-12-13 11:13:18 +01:00
contract_base.rb DEV: Remove hash-like access from service contracts 2024-10-29 16:02:51 +01:00
options_base.rb DEV: Provide user input to services using params key 2024-10-25 09:57:59 +02:00
policy_base.rb
runner.rb DEV: Display better output when inspecting service steps 2024-12-12 15:21:10 +01:00
steps_inspector.rb DEV: Display better output when inspecting service steps 2024-12-12 15:21:10 +01:00