Sha256: 50f73a45d692b0bab23debe22ab7415da0d1f4812963f9e249921f65c6189484
Contents?: true
Size: 739 Bytes
Versions: 10
Compression:
Stored size: 739 Bytes
Contents
# frozen_string_literal: true require "forwardable" module Pakyow class Plugin class Lookup include Enumerable extend Forwardable def_delegators :@plugs, :each, :<< def initialize(plugs) @plugs = plugs end def finalize @plugs.map { |plug| plug.class.plugin_name }.uniq.each do |plugin_name| define_singleton_method plugin_name do |plugin_instance_name = :default| plugin_instance_name = plugin_instance_name.to_sym @plugs.find { |plug| plug.class.plugin_name == plugin_name && plug.__object_name.namespace.parts.last == plugin_instance_name } end end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems