Sha256: 7d46c9151ab10d264bd17ef9527c3a084f50841c6c2533b4ae4a5417e4bc781f

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

# frozen_string_literal: true

module ConvenientService
  module Support
    module DependencyContainer
      module Commands
        class DefineEntry < Support::Command
          ##
          # @!attribute [r] container
          #   @return [Module]
          #
          attr_reader :container

          ##
          # @!attribute [r] name
          #   @return [String, Symbol]
          #
          attr_reader :name

          ##
          # @!attribute [r] body
          #   @return [Proc]
          #
          attr_reader :body

          ##
          # @param container [Module]
          # @param name [String, Symbol]
          # @param body [Proc]
          #
          def initialize(container:, name:, body:)
            @container = container
            @name = name
            @body = body
          end

          ##
          # @return [String, Symbol]
          #
          def call
            container.define_singleton_method(name, &body)

            name
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
convenient_service-0.14.0 lib/convenient_service/support/dependency_container/commands/define_entry.rb
convenient_service-0.13.0 lib/convenient_service/support/dependency_container/commands/define_entry.rb
convenient_service-0.12.0 lib/convenient_service/support/dependency_container/commands/define_entry.rb