Sha256: 36b6f33aecd744c03f93b0aeb0076fab085087df7b10c92a8dad621be17f8232

Contents?: true

Size: 369 Bytes

Versions: 5

Compression:

Stored size: 369 Bytes

Contents

require 'ruby2_keywords'

module Patterns
  class Service
    attr_reader :result

    class << self
      ruby2_keywords def call(*args)
        new(*args).tap do |service|
          service.instance_variable_set(
            "@result",
            service.call
          )
        end
      end
    end

    def call
      raise NotImplementedError
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rails-patterns-0.11.0 lib/patterns/service.rb
rails-patterns-0.10.0 lib/patterns/service.rb
rails-patterns-0.9.0 lib/patterns/service.rb
rails-patterns-0.8.0 lib/patterns/service.rb
rails-patterns-0.7.3 lib/patterns/service.rb