Episodes
Daniel said over 2 years ago on Associations and Mathematical Business Logic :
amazing ! I am in design phase for my new app, and it demands this kind of scenario and I was studying what possibilities and or directions to take... now I have an excellent one!!! thank you so much... and looking forward to new episode :)

KelseyDH said almost 2 years ago on Associations and Mathematical Business Logic :
I like to create a generic class for handling the class method / initialization aspect of the service, to simplify those classes.  E.g.:

class ServiceObject

  def self.call(*args)
    new(*args).call
  end

  def call
    raise NotImplementedError
  end

  def perform
    call
  end

end

Then

module Car
  class CalculatePrice < ServiceObject

def initialize(foo) @foo = foo end def call # do something end
end end



Login to Comment