Module: PayDirt::UseCase
- Included in:
- Base
- Defined in:
- lib/pay_dirt/use_case.rb
Overview
Provides the basic functionality every PayDirt service object should have.
Instance Method Summary collapse
-
#load_options(*required_options, options) ⇒ Object
Load instance variables from the provided hash of dependencies.
-
#result(success, data = nil) ⇒ Object
Returns a result object conveying success or failure (
success
) and anydata
.
Instance Method Details
#load_options(*required_options, options) ⇒ Object
Load instance variables from the provided hash of dependencies.
Raises if any required dependencies (required_options
) are missing from options
hash. Optionally, takes and yields a block after loading options. Use this to validate dependencies.
17 18 19 20 21 22 23 24 25 |
# File 'lib/pay_dirt/use_case.rb', line 17 def (*, ) # Load required options .each { |o| = load_option(o, ) } # Load remaining options .each_key { |k| = load_option(k, ) } block_given? ? yield : end |