Class: Hokusai::Commands::Base

Inherits:
Object
  • Object
show all
Defined in:
ui/src/hokusai/commands/base.rb

Direct Known Subclasses

Circle, Image, Rect, SVG, ScissorBegin, ScissorEnd, Text

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.drawObject



9
10
11
# File 'ui/src/hokusai/commands/base.rb', line 9

def self.draw
  @draw
end

.on_draw(&block) ⇒ Object



5
6
7
# File 'ui/src/hokusai/commands/base.rb', line 5

def self.on_draw(&block)
  @draw = block
end

Instance Method Details

#after_draw(canvas) ⇒ Object



19
20
# File 'ui/src/hokusai/commands/base.rb', line 19

def after_draw(canvas)
end

#drawObject

Raises:



13
14
15
16
17
# File 'ui/src/hokusai/commands/base.rb', line 13

def draw
  raise Hokusai::Error.new("No draw callback made for #{self.class}") if self.class.draw.nil?

  self.class.draw.call(self.freeze)
end