Class: PdfParadise::MergeThenOpen

Inherits:
Base
  • Object
show all
Defined in:
lib/pdf_paradise/merge_then_open/merge_then_open.rb

Overview

PdfParadise::MergeThenOpen

Constant Summary collapse

NAMESPACE =
#

NAMESPACE

#
inspect

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#basename, #be_verbose?, #change_directory, #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, #orange, #reset_the_internal_hash, #return_commandline_arguments_starting_with_hyphens, #return_files_from_the_commandline_arguments, #return_pwd, #rev, #set_be_quiet, #steelblue, #try_to_ensure_that_this_directory_exists, #write_what_into

Constructor Details

#initialize(commandline_arguments = nil, run_already = true) ⇒ MergeThenOpen

#

initialize

#


32
33
34
35
36
37
38
39
40
41
# File 'lib/pdf_paradise/merge_then_open/merge_then_open.rb', line 32

def initialize(
    commandline_arguments = nil,
    run_already           = true
  )
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end

Class Method Details

.[](i = '') ⇒ Object

#

PdfParadise::MergeThenOpen[]

#


97
98
99
# File 'lib/pdf_paradise/merge_then_open/merge_then_open.rb', line 97

def self.[](i = '')
  new(i)
end

Instance Method Details

#commandline_arguments?Boolean

#

commandline_arguments?

#

Returns:

  • (Boolean)


68
69
70
# File 'lib/pdf_paradise/merge_then_open/merge_then_open.rb', line 68

def commandline_arguments?
  @commandline_arguments
end

#opnn(i = NAMESPACE) ⇒ Object

#

opnn

#


53
54
55
# File 'lib/pdf_paradise/merge_then_open/merge_then_open.rb', line 53

def opnn(i = NAMESPACE)
  super(i)
end

#resetObject

#

reset (reset tag)

#


46
47
48
# File 'lib/pdf_paradise/merge_then_open/merge_then_open.rb', line 46

def reset
  super()
end

#runObject

#

run (run tag)

#


75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/pdf_paradise/merge_then_open/merge_then_open.rb', line 75

def run
  merge_pdf = MergePdf.new(@commandline_arguments)
  new_file = merge_pdf.output_file?
  if File.exist? new_file
    # ===================================================================== #
    # We have to open this file next.
    # ===================================================================== #
    begin
      require 'open'
      if Object.const_defined? :Open
        opnn; e "Opening #{sfile(new_file)} next."
        Open.in_editor(new_file)
      end
    rescue LoadError; end
  else
    opnn; e "No file appears to exist at #{sfile(new_file)}."
  end
end

#set_commandline_arguments(i = '') ⇒ Object

#

set_commandline_arguments

#


60
61
62
63
# File 'lib/pdf_paradise/merge_then_open/merge_then_open.rb', line 60

def set_commandline_arguments(i = '')
  i = [i].flatten.compact
  @commandline_arguments = i
end