Module: Sevgi::Graphics::Mixtures::Symbols

Defined in:
lib/sevgi/graphics/mixtures/symbols.rb

Overview

DSL helpers for expanding callable modules into SVG symbols.

Instance Method Summary collapse

Instance Method Details

#Symbols(mod, *args, **kwargs, &block) ⇒ Sevgi::Graphics::Element

Renders module callables as symbols under defs.

Parameters:

  • mod (Module)

    callable drawing module

  • args (Array<Object>)

    callable arguments

  • kwargs (Hash)

    defs attributes

Returns:

Raises:

  • (Sevgi::ArgumentError)

    when mod is not a plain module



14
15
16
17
18
19
# File 'lib/sevgi/graphics/mixtures/symbols.rb', line 14

def Symbols(mod, *args, **kwargs, &block)
  CallWithin(mod, :defs, :symbol, *args, **kwargs) do |name, element|
    element[:id] = block ? block.call(name) : name.to_s.split("_").join("-")
    title(name.to_s.split("_").map(&:capitalize).join(" "))
  end
end