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
- #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
7 8 9 10 |
# File 'lib/thousand_island/components/base.rb', line 7 def initialize(pdf, args=nil) = 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 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
34 35 36 |
# File 'lib/thousand_island/components/base.rb', line 34 def self.defaults {} end |
Instance Method Details
#defaults ⇒ Object
38 39 40 |
# File 'lib/thousand_island/components/base.rb', line 38 def defaults self.class.defaults end |
#draw(&block) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/thousand_island/components/base.rb', line 12 def draw(&block) if repeated? render_all &block else render &block end end |
#render(&block) ⇒ Object
26 27 28 |
# File 'lib/thousand_island/components/base.rb', line 26 def render(&block) raise NotImplementedError end |
#render_all(&block) ⇒ Object
20 21 22 23 24 |
# File 'lib/thousand_island/components/base.rb', line 20 def render_all(&block) pdf.repeat :all do render &block end end |
#repeated? ⇒ Boolean
30 31 32 |
# File 'lib/thousand_island/components/base.rb', line 30 def repeated? false end |