Sha256: 347e2c7d86c02b838477f279e6faff0a3311b7dbf0ad729cd13d1e227b736c38
Contents?: true
Size: 755 Bytes
Versions: 95
Compression:
Stored size: 755 Bytes
Contents
# frozen_string_literal: true module Primer # :nodoc: module ExperimentalSlotHelpers def self.included(base) base.extend(ClassMethods) end # :nodoc: module ClassMethods def add_polymorphic_slot_type(slot_name:, type:, callable:) slot_def = registered_slots[slot_name] raise "Unknown slot '#{slot_name}'" unless slot_def poly_def = define_slot( type, collection: slot_def[:collection], callable: callable ) registered_slots[slot_name][:renderable_hash][type] = poly_def define_method(:"with_#{type}") do |**system_arguments, &block| set_slot(slot_name, poly_def, **system_arguments, &block) end end end end end
Version data entries
95 entries across 95 versions & 2 rubygems