Class: Sugpoko::Component
- Inherits:
-
Object
- Object
- Sugpoko::Component
- Defined in:
- lib/sugpoko/component.rb
Instance Attribute Summary collapse
-
#cursor_origin ⇒ Object
readonly
Returns the value of attribute cursor_origin.
-
#pdf ⇒ Object
readonly
Returns the value of attribute pdf.
Instance Method Summary collapse
- #draw(klass, options = {}) ⇒ Object
- #generate ⇒ Object
-
#initialize(options = {}) ⇒ Component
constructor
A new instance of Component.
Constructor Details
#initialize(options = {}) ⇒ Component
Returns a new instance of Component.
12 13 14 15 |
# File 'lib/sugpoko/component.rb', line 12 def initialize( = {}) @pdf = .fetch(:pdf) @cursor_origin = pdf.cursor end |
Instance Attribute Details
#cursor_origin ⇒ Object (readonly)
Returns the value of attribute cursor_origin.
2 3 4 |
# File 'lib/sugpoko/component.rb', line 2 def cursor_origin @cursor_origin end |
#pdf ⇒ Object (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, = {}) klass.new(.merge(pdf: pdf)).generate end |
#generate ⇒ Object
4 5 6 |
# File 'lib/sugpoko/component.rb', line 4 def generate raise '#generate not defined' end |