Module: Microstation::PdfSupport

Included in:
Dir, Drawing::File
Defined in:
lib/microstation/pdf_support.rb

Instance Method Summary collapse

Instance Method Details

#file_exists?(file) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/microstation/pdf_support.rb', line 17

def file_exists?(file)
  file.file?
end

#mtimeObject



31
32
33
# File 'lib/microstation/pdf_support.rb', line 31

def mtime
  self.path.mtime
end

#needs_pdf?(output_dir = nil) ⇒ Boolean

Returns:

  • (Boolean)


21
22
23
24
# File 'lib/microstation/pdf_support.rb', line 21

def needs_pdf?(output_dir=nil)
  pdf_path = pdf_name(output_dir)
  !file_exists?(pdf_path) || pdf_older?(pdf_path)
end

#pdf_exists?(output_dir = nil) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/microstation/pdf_support.rb', line 13

def pdf_exists?(output_dir = nil)
  pdf_name(output_dir).file?
end

#pdf_name(output_dir = nil) ⇒ Object



6
7
8
9
10
11
# File 'lib/microstation/pdf_support.rb', line 6

def pdf_name(output_dir=nil)
  name = self.basename
  dir = output_dir || self.dirname
  pdfname = Pathname(name).ext('pdf')
  (dir + pdfname).expand_path
end

#pdf_older?(pdf) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/microstation/pdf_support.rb', line 26

def pdf_older?(pdf)
  self.mtime > pdf.mtime
end