Sha256: 4c1054494fd8b3eae045390624bd133111be71ab83c7ff7264163e480b70ca2a

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

require_relative "service/class_methods"

module ConvenientService
  module Service
    module Plugins
      module CanHaveSteps
        module Entities
          ##
          # NOTE: Service is a wrapper for a service class (klass). For example:
          #
          #   step SomeService, in: :foo, out: :bar
          #   # klass is `SomeService` in this particular case.
          #
          class Service
            include Support::Castable
            include Support::Delegate

            extend ClassMethods

            delegate :result, :step_class, to: :klass

            attr_reader :klass

            def initialize(klass)
              @klass = klass
            end

            def has_defined_method?(method)
              Utils::Method.defined?(method, klass, private: true)
            end

            def ==(other)
              casted = cast(other)

              return unless casted

              return false if klass != casted.klass

              true
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
convenient_service-0.12.0 lib/convenient_service/service/plugins/can_have_steps/entities/service.rb
convenient_service-0.11.0 lib/convenient_service/service/plugins/can_have_steps/entities/service.rb