class Voom::Commands::Base

Attributes

params[R]

Public Class Methods

call(*args, **params, &block) click to toggle source
# File lib/voom/commands/base.rb, line 33
def self.call(*args, **params, &block)
  rescue_logical_errors {new(*args, **params, &block).call(&block)}
end
call!(*args, **params, &block) click to toggle source
# File lib/voom/commands/base.rb, line 37
def self.call!(*args, **params, &block)
  self.new(*args, **params, &block).call(&block)
end
new(*args, **params_, &block) click to toggle source
# File lib/voom/commands/base.rb, line 20
def initialize(*args, **params_, &block)
  @params = params_.any? ? validate_params(**params_) : {}
  @block = block
end

Public Instance Methods

call() click to toggle source
# File lib/voom/commands/base.rb, line 25
def call
  response = self.perform
  response = response.respond_to?(:success?) ? response : success
  response2 = @block.call(response, self) if @block
  response = response2.respond_to?(:success?) ? response2 : response
  response.respond_to?(:success?) ? response : success
end