Module: Sevgi::Toplevel

Included in:
Sevgi
Defined in:
lib/sevgi/toplevel.rb,
lib/sevgi/toplevel/derender.rb,
lib/sevgi/toplevel/executor.rb,
lib/sevgi/toplevel/function.rb,
lib/sevgi/toplevel/geometry.rb,
lib/sevgi/toplevel/graphics.rb,
lib/sevgi/toplevel/sundries.rb

Defined Under Namespace

Modules: Function

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.constantsObject (readonly)

Returns the value of attribute constants.



8
9
10
# File 'lib/sevgi/toplevel.rb', line 8

def constants
  @constants
end

Class Method Details

.extended(base) ⇒ Object



29
30
31
32
# File 'lib/sevgi/toplevel.rb', line 29

def self.extended(base)
  super
  inject(base)
end

.included(base) ⇒ Object



24
25
26
27
# File 'lib/sevgi/toplevel.rb', line 24

def self.included(base)
  super
  inject(base)
end

Instance Method Details

#Decompile(file, id) ⇒ Object



7
# File 'lib/sevgi/toplevel/derender.rb', line 7

def Decompile(file, id) = Derender.decompile_file(file, id:)

#Decompile!(file, id) ⇒ Object



9
# File 'lib/sevgi/toplevel/derender.rb', line 9

def Decompile!(file, id) = Derender.decompile_file!(file, id:)

#Derender(file, id) ⇒ Object



11
# File 'lib/sevgi/toplevel/derender.rb', line 11

def Derender(file, id) = Derender.derender_file(file, id:)

#Derender!(file, id) ⇒ Object



13
# File 'lib/sevgi/toplevel/derender.rb', line 13

def Derender!(file, id) = Derender.derender_file!(file, id:)

#Grid(canvas, unit:, multiple:) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/sevgi/toplevel/sundries.rb', line 7

def Grid(canvas, unit:, multiple:)
  ArgumentError.("Must be a Canvas: #{canvas}") unless canvas.is_a?(Graphics::Canvas)

  Sundries::Grid[
    Sundries::Ruler.new(brut: canvas.width, unit:, multiple:, margin: canvas.left),
    Sundries::Ruler.new(brut: canvas.height, unit:, multiple:, margin: canvas.top)
  ]
end

#Load(*files) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/sevgi/toplevel/executor.rb', line 15

def Load(*files)
  start = ::File.dirname(caller_locations(1..1).first.path)

  files.each do |file|
    location = F.locate(file, start, exclude: start)

    ::Sevgi::Executor.load(location.file)
  end
end

#MixinObject



7
# File 'lib/sevgi/toplevel/graphics.rb', line 7

def Mixin(...) = Graphics::Mixtures.mixin(...)

#Paper(width, height, name = :custom, unit: "mm") ⇒ Object



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

def Paper(width, height, name = :custom, unit: "mm")
  name.tap { Graphics::Paper.define(name, width:, height:, unit:) unless Graphics::Paper.exist?(name) }
end

#Paper!(width, height, name = :custom, unit: "mm") ⇒ Object



13
14
15
# File 'lib/sevgi/toplevel/graphics.rb', line 13

def Paper!(width, height, name = :custom, unit: "mm")
  name.tap { Graphics::Paper.define(name, width:, height:, unit:) }
end