Sha256: 6cb783770dfa9696ee935540e0af2a3b820eb7c49f0520e92ae5d5f56ce36f3b

Contents?: true

Size: 837 Bytes

Versions: 51

Compression:

Stored size: 837 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/common_concern'
require 'eac_ruby_utils/patches/string/inflector'

module EacRubyUtils
  module MethodClass
    common_concern do
      ::EacRubyUtils::MethodClass::Setup.new(self)
    end

    class Setup
      common_constructor :method_class do
        perform
      end

      def perform
        the_setup = self
        sender_module.define_method(method_name) do |*args, &block|
          the_setup.method_class.new(self, *args, &block).result
        end
      end

      def method_name
        method_class.name.demodulize.underscore.variableize
      end

      def sender_module
        method_class.module_parent
      end
    end
  end
end

Version data entries

51 entries across 51 versions & 3 rubygems

Version Path
eac_tools-0.27.2 sub/eac_ruby_utils/lib/eac_ruby_utils/method_class.rb
eac_tools-0.27.1 sub/eac_ruby_utils/lib/eac_ruby_utils/method_class.rb
eac_tools-0.27.0 sub/eac_ruby_utils/lib/eac_ruby_utils/method_class.rb
eac_tools-0.26.0 sub/eac_ruby_utils/lib/eac_ruby_utils/method_class.rb
eac_ruby_utils-0.102.0 lib/eac_ruby_utils/method_class.rb
eac_tools-0.25.1 sub/eac_ruby_utils/lib/eac_ruby_utils/method_class.rb
eac_ruby_utils-0.101.0 lib/eac_ruby_utils/method_class.rb
eac_tools-0.25.0 sub/eac_ruby_utils/lib/eac_ruby_utils/method_class.rb
eac_tools-0.24.1 sub/eac_ruby_utils/lib/eac_ruby_utils/method_class.rb
eac_ruby_utils-0.100.0 lib/eac_ruby_utils/method_class.rb
eac_tools-0.24.0 sub/eac_ruby_utils/lib/eac_ruby_utils/method_class.rb
eac_ruby_utils-0.99.0 lib/eac_ruby_utils/method_class.rb
eac_tools-0.23.0 sub/eac_ruby_utils/lib/eac_ruby_utils/method_class.rb
eac_tools-0.22.0 sub/eac_ruby_utils/lib/eac_ruby_utils/method_class.rb
eac_tools-0.21.0 sub/eac_ruby_utils/lib/eac_ruby_utils/method_class.rb
eac_tools-0.20.0 sub/eac_ruby_utils/lib/eac_ruby_utils/method_class.rb
eac_tools-0.19.0 sub/eac_ruby_utils/lib/eac_ruby_utils/method_class.rb
eac_tools-0.18.0 sub/eac_ruby_utils/lib/eac_ruby_utils/method_class.rb
eac_tools-0.17.0 sub/eac_ruby_utils/lib/eac_ruby_utils/method_class.rb
eac_tools-0.16.1 sub/eac_ruby_utils/lib/eac_ruby_utils/method_class.rb