Follow the Brass

lib/work_in_progress.rb

15 lines · ruby

Project files
# frozen_string_literal: true

WorkInProgress = Data.define(:cartridge_case, :facts) do
  def initialize(cartridge_case:, facts: {})
    super(cartridge_case:, facts: facts.dup.freeze)
  end

  def with_fact(name)
    with(facts: facts.merge(name => true))
  end

  def fact?(name)
    facts[name] == true
  end
end

Read along in the manual: The Reloading Lab · Download the project (zip)