Sha256: 87c72d1a27b118b9c99d802c0272de1a9077712fbaab3b7c6f5916baa271dda4
Contents?: true
Size: 837 Bytes
Versions: 1
Compression:
Stored size: 837 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, &block) sig = sig(&block) parameter_list = sig.parameters.map { |parameter| "#{parameter.name}:" }.join(", ") argument_list = sig.parameters.map { |parameter| "#{parameter.name}: #{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}(#{argument_list}, &block) # implementation.method_name(one: one, two: two, three: three, &block) end # end RUBY end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
strict-1.2.0 | lib/strict/interface.rb |