class ThousandIsland::Components::Base

Attributes

options[R]
pdf[R]

Public Class Methods

defaults() click to toggle source
# File lib/thousand_island/components/base.rb, line 39
def self.defaults
  {}
end
new(pdf, args=nil) click to toggle source
# File lib/thousand_island/components/base.rb, line 7
def initialize(pdf, args=nil)
  @options = args || self.defaults
  @pdf = pdf
end

Public Instance Methods

after_render() click to toggle source
# File lib/thousand_island/components/base.rb, line 21
def after_render
  nil
end
defaults() click to toggle source
# File lib/thousand_island/components/base.rb, line 43
def defaults
  self.class.defaults
end
draw(&block) click to toggle source
# 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) click to toggle source
# File lib/thousand_island/components/base.rb, line 31
def render(&block)
  raise NotImplementedError
end
render_all(&block) click to toggle source
# File lib/thousand_island/components/base.rb, line 25
def render_all(&block)
  pdf.repeat :all do
    render &block
  end
end
repeated?() click to toggle source
# File lib/thousand_island/components/base.rb, line 35
def repeated?
  false
end