Class: Sugpoko::Component

Inherits:
Object
  • Object
show all
Defined in:
lib/sugpoko/component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Component

Returns a new instance of Component.



12
13
14
15
# File 'lib/sugpoko/component.rb', line 12

def initialize(options = {})
  @pdf = options.fetch(:pdf)
  @cursor_origin = pdf.cursor
end

Instance Attribute Details

#cursor_originObject (readonly)

Returns the value of attribute cursor_origin.



2
3
4
# File 'lib/sugpoko/component.rb', line 2

def cursor_origin
  @cursor_origin
end

#pdfObject (readonly)

Returns the value of attribute pdf.



2
3
4
# File 'lib/sugpoko/component.rb', line 2

def pdf
  @pdf
end

Instance Method Details

#draw(klass, options = {}) ⇒ Object



8
9
10
# File 'lib/sugpoko/component.rb', line 8

def draw(klass, options = {})
  klass.new(options.merge(pdf: pdf)).generate
end

#generateObject



4
5
6
# File 'lib/sugpoko/component.rb', line 4

def generate
  raise '#generate not defined'
end