Module: Plumr::Fitting

Included in:
Command, File
Defined in:
lib/plumr.rb

Overview

The base interface for a Plumr “fitting”, for instance Plumr::File or Plumr::Command

Instance Method Summary collapse

Instance Method Details

#cleanupObject

Disposes of any temporary files or resources that we know how to recreate later.

Raises:

  • (NotImplementedError)


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.

Raises:

  • (NotImplementedError)


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

Raises:

  • (NotImplementedError)


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.

Raises:

  • (NotImplementedError)


60
61
62
# File 'lib/plumr.rb', line 60

def generate_temp(prefix, index)
  raise NotImplementedError, "#{self.class}#generate_temp not implemented"
end

#isolateObject

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.

Raises:

  • (NotImplementedError)


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

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


79
80
81
# File 'lib/plumr.rb', line 79

def older_than?(timestamp)
  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

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


73
74
75
# File 'lib/plumr.rb', line 73

def up_to_date?
  raise NotImplementedError, "#{self.class}#up_to_date? not implemented"
end