lib/eco/api/session.rb in eco-helpers-1.5.13 vs lib/eco/api/session.rb in eco-helpers-1.5.14

- old
+ new

@@ -185,14 +185,27 @@ yield(wf, io) if block_given? end end # Does merge `Eco::API::UseCases::DefaultCases` with the custom cases. + # @note + # - the order matters, as a default usecase can be redefined by a custom one with same name # @return [Eco::API::UseCases] def usecases @usecases ||= config.usecases.dup.tap do |cases| all_cases = Eco::API::UseCases::DefaultCases.new.merge(config.usecases) cases.merge(all_cases) + end + end + + # Does merge `Eco::API::Policies::DefaultPolicies` with the custom policies. + # @note + # - the default policies are added at the end (meaning they will run after the custom policies) + # @return [Eco::API::Policies] + def policies + @policies ||= config.policies.dup.tap do |policies| + default_policies = Eco::API::Policies::DefaultPolicies.new + policies.merge(default_policies) end end # Set of helpers to simplify your code # @see Eco::API::MicroCases