class VirtualDate::Explanation

Overview

Holds a buffer of string explanations, for scheduling etc.

This is a reference type on purpose: a Candidate hands its buffer to the Scheduled it turns into, and both go on appending to the same buffer.

Defined in:

virtualdate.cr

Constant Summary

MAX_LINES = 100

Maximum number of messages kept. Once reached, the penultimate line gives way to a notice of how many were dropped.

Constructors

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def add(msg : String) : Bool #

Appends msg, and returns whether the buffer still had room for it.

Once it is full the most recent message is kept in place of the previous one, rather than dropped: the last thing said about a candidate is its verdict, and for a vdate scheduled over a conflict because dependents require it, that line is the only thing telling a deliberate over-subscription apart from a scheduling fault.


[View source]
def dropped : Int32 #

How many messages have been dropped for want of room


[View source]
def lines : Array(String) #

Read-only: #add maintains the size invariant the overflow handling below relies on, and an externally assigned short array would break it.


[View source]
def to_s(io : IO) : Nil #
Description copied from class Reference

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).to_s # => #<Person:0x10a199f20>

[View source]