Class: Laser::Cutter::Renderer::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/laser-cutter/renderer/base.rb

Overview

subject is what we are rendering enclosure is the rectangle enclosing our subject’s rendered image page_manager contains access to units and page sizes

Constant Summary collapse

BLACK =
"000000"
BLUE =
"0070E0"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, subject = nil) ⇒ Base

Returns a new instance of Base.



13
14
15
16
17
# File 'lib/laser-cutter/renderer/base.rb', line 13

def initialize(config, subject = nil)
  self.config = config
  self.subject = subject
  self.page_manager = Laser::Cutter::PageManager.new(config.units)
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



11
12
13
# File 'lib/laser-cutter/renderer/base.rb', line 11

def config
  @config
end

#enclosureObject

Returns the value of attribute enclosure.



11
12
13
# File 'lib/laser-cutter/renderer/base.rb', line 11

def enclosure
  @enclosure
end

#page_managerObject

Returns the value of attribute page_manager.



11
12
13
# File 'lib/laser-cutter/renderer/base.rb', line 11

def page_manager
  @page_manager
end

#subjectObject

Returns the value of attribute subject.



11
12
13
# File 'lib/laser-cutter/renderer/base.rb', line 11

def subject
  @subject
end

Instance Method Details

#renderObject



19
20
21
# File 'lib/laser-cutter/renderer/base.rb', line 19

def render
  raise 'Abstract method'
end

#unitsObject



23
24
25
# File 'lib/laser-cutter/renderer/base.rb', line 23

def units
  config.units.to_sym || :mm
end