Module: Plumr::Fitting
Overview
The base interface for a Plumr “fitting”, for instance Plumr::File or Plumr::Command
Instance Method Summary collapse
-
#cleanup ⇒ Object
Disposes of any temporary files or resources that we know how to recreate later.
-
#cleanup_temp(filename) ⇒ Object
Cleans up a temporary file created by generate_temp, if it is appropriate to do so; should be called on the same fixture that generated the file.
-
#generate(output_file) ⇒ Object
Dumps the fitting’s output to the file named by
output_file
. -
#generate_temp(prefix, index) ⇒ Object
Generates a temporary file; hints for the temporary filename are provided in the form of a
prefix
and a numericindex
; the actual name of created file is returned. -
#isolate ⇒ Object
Returns an “isolated” version of a fitting with any input Plumr::File objects replaced by their output filenames.
-
#older_than?(timestamp) ⇒ Boolean
Returns true if the fitting’s output is up-to-date as of the given timestamp.
-
#up_to_date? ⇒ Boolean
Returns true if the fitting’s output is up-to-date with respect to its inputs.
Instance Method Details
#cleanup ⇒ Object
Disposes of any temporary files or resources that we know how to recreate later.
52 53 54 |
# File 'lib/plumr.rb', line 52 def cleanup raise NotImplementedError, "#{self.class}#cleanup not implemented" end |
#cleanup_temp(filename) ⇒ Object
Cleans up a temporary file created by generate_temp, if it is appropriate to do so; should be called on the same fixture that generated the file.
67 68 69 |
# File 'lib/plumr.rb', line 67 def cleanup_temp(filename) raise NotImplementedError, "#{self.class}#cleanup_temp not implemented" end |
#generate(output_file) ⇒ Object
Dumps the fitting’s output to the file named by output_file
46 47 48 |
# File 'lib/plumr.rb', line 46 def generate(output_file) raise NotImplementedError, "#{self.class}#generate not implemented" end |
#generate_temp(prefix, index) ⇒ Object
Generates a temporary file; hints for the temporary filename are provided in the form of a prefix
and a numeric index
; the actual name of created file is returned. The file should not be deleted except via calling cleanup_temp.
60 61 62 |
# File 'lib/plumr.rb', line 60 def generate_temp(prefix, index) raise NotImplementedError, "#{self.class}#generate_temp not implemented" end |
#isolate ⇒ Object
Returns an “isolated” version of a fitting with any input Plumr::File objects replaced by their output filenames. Returns a pair consisting of a source and a set of additional dependencies. The source and dependencies will be either filenames or Fittings.
87 88 89 |
# File 'lib/plumr.rb', line 87 def isolate raise NotImplementedError, "#{self.class}#isolate not implemented" end |
#older_than?(timestamp) ⇒ Boolean
Returns true if the fitting’s output is up-to-date as of the given timestamp
79 80 81 |
# File 'lib/plumr.rb', line 79 def older_than?() raise NotImplementedError, "#{self.class}#older_than? not implemented" end |
#up_to_date? ⇒ Boolean
Returns true if the fitting’s output is up-to-date with respect to its inputs
73 74 75 |
# File 'lib/plumr.rb', line 73 def up_to_date? raise NotImplementedError, "#{self.class}#up_to_date? not implemented" end |