Class: Eleanor::TitlePage

Inherits:
Page
  • Object
show all
Defined in:
lib/eleanor.rb,
lib/eleanor/hpdfpaper.rb

Overview

A screenplay title page.

Instance Attribute Summary collapse

Attributes inherited from Page

#page_no, #paras, #screenplay

Instance Method Summary collapse

Methods inherited from Page

#body_height, #margin_top_actual, #max_body_height, #push_para, #to_s

Constructor Details

#initialize(options = {}) ⇒ TitlePage

options can include any title page elements recognized by the parser and backend. With the default parser and backend, options include :author, :contact, and :title. :author and :title are strings. :contact is an array of strings. Each option is turned into an instance variable.



503
504
505
506
507
# File 'lib/eleanor.rb', line 503

def initialize options={}
  options.each_pair do |att_name, att_val|
    instance_variable_set("@#{att_name}", att_val)
  end
end

Instance Attribute Details

#authorObject (readonly)

See initialize



497
498
499
# File 'lib/eleanor.rb', line 497

def author
  @author
end

#contactObject (readonly)

See initialize



497
498
499
# File 'lib/eleanor.rb', line 497

def contact
  @contact
end

#titleObject (readonly)

See initialize



497
498
499
# File 'lib/eleanor.rb', line 497

def title
  @title
end

Instance Method Details

#write_to_paper(pdf_page, line_height_pts) ⇒ Object

An implementation detail in the backend. See lib/eleanor/hpdfpaper.rb.



305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
# File 'lib/eleanor/hpdfpaper.rb', line 305

def write_to_paper pdf_page, line_height_pts
  pdf_page.begin_text
  pdf_page.move_to_top
  pdf_page.move_down(self.margin_top)
  pdf_page.line_center(@title, line_height_pts) unless @title.nil?
  pdf_page.move_down(1.lines)
  unless @by.nil?
    pdf_page.line_center(@by, line_height_pts)
    pdf_page.move_down(1.lines)
  end
  pdf_page.line_center(@author, line_height_pts) unless @author.nil?
  unless @contact.nil?
    pdf_page.move_to_top
    pdf_page.move_down(self.height -
                       (@contact.size * line_height_pts).points -
                       self.margin_bottom)
    pdf_page.margin_left= self.margin_left
    @contact.each { |line| pdf_page.line(line, line_height_pts) }
  end
  pdf_page.end_text
end