♦️ RUBY ENCHANTMENTS DIFFICULTY: Apprentice Behavioral

The Template Method

A rigid skeleton for standard dark rituals, allowing subclasses to customize only specific, permitted sacrifices.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Template Method
ARCANUM SCHOOL: Evocation // Rituals
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// DYNAMIC RUBY BLOOD MAGIC //
class BaseRitual
  def execute
    prepare_altar
    offer_sacrifice
    chant_incantation
    bind_power
  end

  def prepare_altar
    puts "Lighting black candles."
  end

  def offer_sacrifice
    raise NotImplementedError, "Must define the sacrifice!"
  end

  def chant_incantation
    raise NotImplementedError, "Must define the chant!"
  end

  def bind_power
    puts "The power is bound to the caster."
  end
end

class SummonImpRitual < BaseRitual
  def offer_sacrifice
    puts "Offering a rat's blood."
  end

  def chant_incantation
    puts "Chanting: Veni, minor daemon!"
  end
end

The Template Method defines the skeleton of an algorithm in a base class but lets subclasses override specific steps. The BaseRitual guarantees the altar is prepared and the power is bound in the exact right order, leaving only the sacrifice and chant to the whims of the adept.

Runic Tags: #ruby #design-pattern #template-method #blood-magic