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)


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

def file_exists?(file)
  file.file?
end

#mtimeObject



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

def mtime
  path.mtime
end

#needs_pdf?(output_dir = nil) ⇒ Boolean

Returns:

  • (Boolean)


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

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)


10
11
12
# File 'lib/microstation/pdf_support.rb', line 10

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

#pdf_name(output_dir = nil) ⇒ Object



3
4
5
6
7
8
# File 'lib/microstation/pdf_support.rb', line 3

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

#pdf_older?(pdf) ⇒ Boolean

Returns:

  • (Boolean)


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

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