Module: Sumi::Graphics::Modules

Defined in:
graphics/lib/sumi/graphics/mixtures/call.rb

Overview

Recursive callable drawing module support. Extend a module with this API when it and the modules defined beneath it form a callable drawing namespace. Existing and subsequently defined descendants receive the same recursive contract. Classes, autoloads, and modules aliased from another namespace are left unchanged.

Examples:

Define a callable drawing namespace

module Icons
  extend Sumi::Graphics::Modules

  module Alert
    base { css ".alert" => { fill: "red" } }

    def call(id)
      circle id:, class: "alert", r: 5
    end
  end
end

Sumi::Graphics.SVG { Call Icons::Alert, "warning" }

See Also: