Class: PdfParadise::AutomaticPdfTitle
- Inherits:
-
Base
- Object
- Base
- PdfParadise::AutomaticPdfTitle
show all
- Defined in:
- lib/pdf_paradise/utility_scripts/automatic_pdf_title.rb
Overview
PdfParadise::AutomaticPdfTitle
Constant Summary
Constants inherited
from Base
Base::NAMESPACE
Instance Method Summary
collapse
Methods inherited from Base
#basename, #be_verbose?, #change_directory, #commandline_arguments?, #copy_file, #delete_file, #e, #ecomment, #esystem, #first_argument?, #gold, #infer_the_namespace, #input_without_leading_hyphens?, #internal_hash?, #is_an_image_file?, #is_on_roebe?, #lightsteelblue, #log_dir?, #mkdir, #mv, #n_pages?, #namespace?, #no_file_at, #opne, #opnn, #orange, #reset_the_internal_hash, #return_commandline_arguments_starting_with_hyphens, #return_files_from_the_commandline_arguments, #return_pwd, #rev, #set_be_quiet, #set_commandline_arguments, #steelblue, #try_to_ensure_that_this_directory_exists, #write_what_into
Constructor Details
#initialize(input_files = ARGV, run_already = true) ⇒ AutomaticPdfTitle
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/pdf_paradise/utility_scripts/automatic_pdf_title.rb', line 23
def initialize(
input_files = ARGV,
run_already = true
)
reset
set_commandline_arguments(
input_files
)
run if run_already
end
|
Instance Method Details
#automatic_pdf_title(i = commandline_arguments?
) ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/pdf_paradise/utility_scripts/automatic_pdf_title.rb', line 45
def automatic_pdf_title(
i = commandline_arguments?
)
i.each {|this_pdf_file|
if File.exist? this_pdf_file
new_pdf_title = File.basename(this_pdf_file).
sub(/#{File.extname(this_pdf_file)}$/,'').
tr('_',' ')
if new_pdf_title.start_with? 'DONE'
new_pdf_title.sub!(/^DONE_/,'') if new_pdf_title.include? 'DONE_'
new_pdf_title.sub!(/^DONE /,'') if new_pdf_title.include? 'DONE '
end
e "#{rev}Setting the title of the .pdf file "\
"#{sfile(this_pdf_file)} #{rev}to:"
e
e " #{PdfParadise.darkolivegreen(new_pdf_title)}"
e
PdfParadise.set_pdf_title(
this_pdf_file,
new_pdf_title )
else
e "#{rev}No .pdf file exists at `#{sfile(this_pdf_file)}#{rev}`."
end
}
end
|
#reset ⇒ Object
37
38
39
40
|
# File 'lib/pdf_paradise/utility_scripts/automatic_pdf_title.rb', line 37
def reset
super()
infer_the_namespace
end
|
#run ⇒ Object
78
79
80
|
# File 'lib/pdf_paradise/utility_scripts/automatic_pdf_title.rb', line 78
def run
automatic_pdf_title(commandline_arguments?)
end
|