class Sheen::Style::Builder

Overview

A mutable scratch object yielded by Sheen.style. Forwards every setter to the wrapped immutable Style and accumulates the result, so block-style config reads imperatively while the Style stays immutable under the covers.

Defined in:

sheen/style.cr

Constructors

Macro Summary

Instance Method Summary

Constructor Detail

def self.new(renderer : Renderer) #

[View source]

Macro Detail

macro method_missing(call) #

Forward any setter call to the wrapped Style, storing the new Style.


[View source]

Instance Method Detail

def style : Style #

The accumulated Style so far.


[View source]
def transform(&block : String -> String) : self #

Style#transform captures its block as a proc, so it needs an explicit forwarder defined here in Builder. Otherwise Builder#method_missing can't forward the block to Style#transform because it rewrites a forwarded block into yield, which is illegal inside a captured block.


[View source]