Sha256: 59a7e2fc30ac3cd7bebd4b9d1a344c864303b688f19392e9b9c35365b99d1176
Contents?: true
Size: 1.46 KB
Versions: 4
Compression:
Stored size: 1.46 KB
Contents
# frozen_string_literal: true module ConvenientService module Support module DependencyContainer module Export include Support::Concern ## # @param klass [Class, Module] # @return [Module] # included do |klass| raise Exceptions::NotModule.new(klass: klass) unless klass.instance_of?(::Module) end class_methods do ## # @param slug [String, Symbol] # @param scope [:instance, :class] # @param body [Proc] # @return [ConvenientService::Support::DependencyContainer::Entities::Method] # # @internal # NOTE: `export` does NOT accept `prepend` kwarg intentionally. # It is done to follow "the Ruby way". # You won't ever see a module in Ruby that contains methods for `include` and `prepend` at the same time. # So why `export` should allow to do it? # def export(slug, scope: Constants::DEFAULT_SCOPE, &body) Commands::AssertValidScope.call(scope: scope) Entities::Method.new(slug: slug, scope: scope, body: body).tap { |method| exported_methods << method } end ## # @return [ConvenientService::Support::DependencyContainer::Entities::MethodCollection] # def exported_methods @exported_methods ||= Entities::MethodCollection.new end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems