🎲 R HARUSPEX DIFFICULTY: Adept Behavioral

The Command: Encapsulating the Ritual

Wrapping divination requests into objects.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Command
ARCANUM SCHOOL: Divination // Incantation Storage
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// R PATTERN //
library(R6)

# Command Interface
RitualCommand <- R6Class("RitualCommand",
  public = list(
    execute = function() stop("Not implemented")
  )
)

# Receiver
DivinationAltar <- R6Class("DivinationAltar",
  public = list(
    burn_incense = function() "Incense burning.",
    read_bones = function() "Bones read."
  )
)

# Concrete Command
PerformDivinationCommand <- R6Class("PerformDivinationCommand", inherit = RitualCommand,
  private = list(
    altar = NULL
  ),
  public = list(
    initialize = function(altar) {
      private$altar <- altar
    },
    execute = function() {
      paste(private$altar$burn_incense(), private$altar$read_bones())
    }
  )
)

# Invoker
Acolyte <- R6Class("Acolyte",
  private = list(
    command = NULL
  ),
  public = list(
    set_command = function(command) {
      private$command <- command
    },
    invoke = function() {
      private$command$execute()
    }
  )
)

Commands encapsulate all information needed to perform an action or trigger an event later, letting acolytes queue rituals overnight.

Runic Tags: #R6 #Divination #Behavioral #Command