Class: Sevgi::Graphics::Profile

Inherits:
Object
  • Object
show all
Defined in:
lib/sevgi/graphics/auxilary/profile.rb

Defined Under Namespace

Modules: DSL

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, attributes: nil, preambles: nil) ⇒ Profile

Returns a new instance of Profile.



22
23
24
25
26
# File 'lib/sevgi/graphics/auxilary/profile.rb', line 22

def initialize(name, attributes: nil, preambles: nil)
  @name       = name
  @attributes = attributes || {}
  @preambles  = preambles
end

Class Attribute Details

.availableObject (readonly)

Returns the value of attribute available.



9
10
11
# File 'lib/sevgi/graphics/auxilary/profile.rb', line 9

def available
  @available
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



20
21
22
# File 'lib/sevgi/graphics/auxilary/profile.rb', line 20

def attributes
  @attributes
end

#nameObject (readonly)

Returns the value of attribute name.



20
21
22
# File 'lib/sevgi/graphics/auxilary/profile.rb', line 20

def name
  @name
end

#preamblesObject (readonly)

Returns the value of attribute preambles.



20
21
22
# File 'lib/sevgi/graphics/auxilary/profile.rb', line 20

def preambles
  @preambles
end

Class Method Details

.[](name) ⇒ Object



17
# File 'lib/sevgi/graphics/auxilary/profile.rb', line 17

def [](name)              = available[name]

.call(document, canvas = nil, &block) ⇒ Object



11
12
13
# File 'lib/sevgi/graphics/auxilary/profile.rb', line 11

def call(document, canvas = nil, **, &block)
  (klass = self[document]).root(**klass.attributes, **(canvas ? Canvas.(canvas).attributes : {}), **, &block)
end

.register(name, klass) ⇒ Object



15
# File 'lib/sevgi/graphics/auxilary/profile.rb', line 15

def register(name, klass) = (available[name] = klass)