Sha256: 4c500efc2fb74877b4dbdc338e25247404e6cf11089db66f3a1ee8513b994318

Contents?: true

Size: 706 Bytes

Versions: 1

Compression:

Stored size: 706 Bytes

Contents

# frozen_string_literal: true

module Strict
  module Interface
    def self.extended(mod)
      mod.extend(Strict::Method)
      mod.include(Interfaces::Instance)
    end

    def expose(method_name, &)
      sig = sig(&)
      parameter_list = sig.parameters.map { |parameter| "#{parameter.name}:" }.join(", ")

      module_eval(<<~RUBY, __FILE__, __LINE__ + 1)
        def #{method_name}(#{parameter_list}, &block)              # def method_name(one:, two:, three:, &block)
          implementation.#{method_name}(#{parameter_list}, &block) #   implementation.method_name(one:, two:, three:, &block)
        end                                                        # end
      RUBY
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
strict-1.1.0 lib/strict/interface.rb