Sha256: 84dc4febd1ac7b0631f6f5ca328493ce71ca2d2f8022774ea5221bda7a2d7ab2
Contents?: true
Size: 876 Bytes
Versions: 19
Compression:
Stored size: 876 Bytes
Contents
# frozen_string_literal: true require 'active_support/core_ext/module/introspection' require 'eac_ruby_utils/patches/class/common_constructor' require 'eac_ruby_utils/patches/module/module_parent' require 'eac_ruby_utils/patches/string/inflector' module EacRubyUtils class ActsAsInstanceMethod common_constructor :method_class # @param sender_module [Module, nil] # @return [self] def setup(sender_module = nil) sender_module ||= default_sender_module the_setup = self sender_module.define_method(method_name) do |*args, &block| the_setup.method_class.new(self, *args, &block).result end self end # @return [String] def method_name method_class.name.demodulize.underscore.variableize end # @return [Module] def default_sender_module method_class.module_parent end end end
Version data entries
19 entries across 19 versions & 2 rubygems