Class: ThousandIsland::Components::Base
- Inherits:
-
Object
- Object
- ThousandIsland::Components::Base
- Defined in:
- lib/thousand_island/components/base.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#pdf ⇒ Object
readonly
Returns the value of attribute pdf.
Class Method Summary collapse
Instance Method Summary collapse
- #after_render ⇒ Object
- #defaults ⇒ Object
- #draw(&block) ⇒ Object
-
#initialize(pdf, args = nil) ⇒ Base
constructor
A new instance of Base.
- #render(&block) ⇒ Object
- #render_all(&block) ⇒ Object
- #repeated? ⇒ Boolean
Constructor Details
#initialize(pdf, args = nil) ⇒ Base
Returns a new instance of Base.
7 8 9 10 |
# File 'lib/thousand_island/components/base.rb', line 7 def initialize(pdf, args=nil) @options = args || self.defaults @pdf = pdf end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/thousand_island/components/base.rb', line 5 def @options end |
#pdf ⇒ Object (readonly)
Returns the value of attribute pdf.
5 6 7 |
# File 'lib/thousand_island/components/base.rb', line 5 def pdf @pdf end |
Class Method Details
.defaults ⇒ Object
39 40 41 |
# File 'lib/thousand_island/components/base.rb', line 39 def self.defaults {} end |
Instance Method Details
#after_render ⇒ Object
21 22 23 |
# File 'lib/thousand_island/components/base.rb', line 21 def after_render nil end |
#defaults ⇒ Object
43 44 45 |
# File 'lib/thousand_island/components/base.rb', line 43 def defaults self.class.defaults end |
#draw(&block) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/thousand_island/components/base.rb', line 12 def draw(&block) if repeated? render_all &block else render &block end after_render end |
#render(&block) ⇒ Object
31 32 33 |
# File 'lib/thousand_island/components/base.rb', line 31 def render(&block) raise NotImplementedError end |
#render_all(&block) ⇒ Object
25 26 27 28 29 |
# File 'lib/thousand_island/components/base.rb', line 25 def render_all(&block) pdf.repeat :all do render &block end end |
#repeated? ⇒ Boolean
35 36 37 |
# File 'lib/thousand_island/components/base.rb', line 35 def repeated? false end |