This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
# :nodoc: | |
class ActiveBusiness | |
attr_reader :resolver | |
def initialize | |
@resolver = ActiveBusiness::Resolver.new | |
yield resolver | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
# :nodoc: | |
class ActiveBussinessController < AplicationController | |
def some_action | |
# Dealing with params is a controller's responsibility | |
arg = collect_and_validate_your_params | |
YourActiveBusinessImplementation.call(arg) do |resp| | |
resp.success { |payload| render json: payload.to_json, status: 2xx } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
# :nodoc: | |
class YourActiveBusinessImplementation < ActiveBusiness | |
attr_reader :arg | |
def self.call(arg) | |
new(arg).call | |
end | |