Class: Prune::Elements::Info

Inherits:
Base
  • Object
show all
Defined in:
lib/prune/elements/info.rb

Instance Attribute Summary

Attributes inherited from Base

#document

Instance Method Summary collapse

Methods inherited from Base

#reference, #register, #to_s

Methods included from Functions

#mm_to_pt, #pt_to_mm

Methods included from PObjects

pa, pd, ph, pl, pn, ps

Constructor Details

#initialize(document) ⇒ Info

Initialize.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/prune/elements/info.rb', line 8

def initialize(document)
  super(document)
  date = DateTime.now
  creation_date = date.strftime("D:%Y%m%d%H%M%S")
  creation_date << date.zone.sub(/:/, "'") + "'"
  creator = "#{APPLICATION}-#{VERSION}"
  # Set dictionary.
  @content = pd(
    pn(:CreationDate) => pl(creation_date),
    pn(:ModDate) => pl(creation_date),
    pn(:Author) => pl("UNKNOWN"),
    pn(:Title) => pl("UNKNOWN"),
    pn(:Creator) => pl(creator),
    pn(:Producer) => pl(creator),
    pn(:Trapped) => pn(:False))
  # Register element to document.
  register
end

Instance Method Details

#author=(author) ⇒ Object

Set author of the document.



38
39
40
# File 'lib/prune/elements/info.rb', line 38

def author=(author)
  @content[pn(:Author)] = pl(author)
end

#subject=(subject) ⇒ Object

Set subject of the document.



33
34
35
# File 'lib/prune/elements/info.rb', line 33

def subject=(subject)
  @content[pn(:Subject)] = pl(subject)
end

#title=(title) ⇒ Object

Set title of the document.



28
29
30
# File 'lib/prune/elements/info.rb', line 28

def title=(title)
  @content[pn(:Title)] = pl(title)
end