abstract class Lemonade::Block::BaseBlock

Overview

TODO doc

Note: Any container must add itself to the parents array of a given block. Caching & dynamic block modification in multiple blocks count on that to propagate to parents that a block is dirty.

Example of a basic container:

class Container < Lemonade::BaseBlock
  @blocks = [] of Lemonade::BaseBlock

  def <<(block)
    block.parents << self # Add itself as a parent of the block
    @blocks << block      # Add the block to the container's list of block.
    self
  end
end

Container.new << SomeBlock.new

Direct Known Subclasses

Defined in:

lemonade/block/base.cr

Constant Summary

REMOVE_IVARS_FROM_INSPECT = ["parents"] of ::String

Instance Method Summary

Instance Method Detail

def dirty! #

Mark the block's parents as 'dirty', to force re-render on next redraw.


[View source]
def dirty? #

This is not a cached block, it always needs rendering.


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

Appends a String representation of this object which includes its class name, its object address and the values of all instance variables.

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

Person.new("John", 32).inspect # => #<Person:0x10fd31f20 @name="John", @age=32>

[View source]
def parents : Array(Lemonade::Block::BaseBlock) #

[View source]
def parents=(parents : Array(Lemonade::Block::BaseBlock)) #

[View source]
def redraw(io) #

TODO doc


[View source]
abstract def render(io) #

TODO doc


[View source]