From 5f9edf5f40c505f04ac47e711b6aeff1fb33e650 Mon Sep 17 00:00:00 2001 From: AnotherRegularDude Date: Mon, 16 Dec 2024 02:42:42 +0300 Subject: [PATCH] require all lib files after module definition --- README.md | 7 ++++--- lib/resol/result.rb | 12 ++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 472eebe..a496ca9 100644 --- a/README.md +++ b/README.md @@ -65,10 +65,9 @@ Descendants of a parent, into which initializer logic has already been imported, You can use both providers for a different services: ```ruby - # Types is a namespace for all types, defined by smart_types. class FirstService < Resol::Service - inject_initializer :smartcore + inject_initializer :smartcore_injector param :first, Types::String param :second, Types::Integer @@ -76,7 +75,7 @@ end # Types is a namespace for all types, defined by dry-types. class SecondService < Resol::Service - inject_initializer :dry + inject_initializer :dry_injector param :first, Types::Strict::String param :second, Types::Strict::Integer @@ -86,6 +85,8 @@ end Both initializers support inheritance. And base features for initialization flow like default value, arguments accessors visibility level, coercible attributes and so on. +List of all supported initializers you can see at `DependencyContainer` definition. + #### Return a result **Note** – calling `success!`/`fail!` methods interrupts `call` method execution. diff --git a/lib/resol/result.rb b/lib/resol/result.rb index 0d1facd..7dd7368 100644 --- a/lib/resol/result.rb +++ b/lib/resol/result.rb @@ -84,4 +84,16 @@ def bind = self alias fmap bind end + + # TODO: Should be in a module, which includes in classes. + # Example; + # rubocop:disable Naming/MethodName + def Success(...) + Success.new(...) + end + + def Failure(...) + Failure.new(...) + end + # rubocop:enable Naming/MethodName end