module Command
Constants
- VERSION
Public Class Methods
new(inputs = {})
click to toggle source
Calls superclass method
# File lib/command.rb, line 21 def initialize(inputs = {}) super(**Command::InputMiddleware.call(inputs)) end
Public Instance Methods
compose(command, *args)
click to toggle source
# File lib/command.rb, line 41 def compose(command, *args) outcome = command.run(*args) raise Command::Interrupt, outcome.failure.errors if outcome.failure? outcome.value! end
execute()
click to toggle source
# File lib/command.rb, line 25 def execute raise NotImplementedError end
inputs()
click to toggle source
# File lib/command.rb, line 49 def inputs self.class.dry_initializer.attributes(self) end
run()
click to toggle source
# File lib/command.rb, line 29 def run result = if errors.empty? && valid? begin execute rescue Command::Interrupt => e errors.merge! e.errors end end errors.empty? ? Success(result) : Failure(Command::Failure.new(result, errors)) end
run!(inputs = {})
click to toggle source
# File lib/command.rb, line 59 def run!(inputs = {}) run(inputs).value! end