class Utopia::Gallery::Process
Attributes
name[R]
Public Class Methods
fresh?(input_path, output_path)
click to toggle source
# File lib/utopia/gallery/process.rb, line 46 def self.fresh?(input_path, output_path) # We are not fresh if the output path doesn't exist: return false unless File.exist?(output_path) # We are not fresh if the input is newere than the output: return false if mtime(input_path) > mtime(output_path) # Otherwise, we are so fresh: return true end
link(input_path, output_path)
click to toggle source
# File lib/utopia/gallery/process.rb, line 57 def self.link(input_path, output_path) # Compute a path to input_path, relative to output_path shortest_path = Utopia::Path.shortest_path(input_path, output_path) FileUtils.ln_s(shortest_path, output_path, force: true) end
mtime(path)
click to toggle source
# File lib/utopia/gallery/process.rb, line 42 def self.mtime(path) File.lstat(path).mtime end
new(name)
click to toggle source
# File lib/utopia/gallery/process.rb, line 29 def initialize(name) @name = name.to_sym end
Public Instance Methods
relative_path(media)
click to toggle source
The relative path for the output generated by this process, given a specific input media:
# File lib/utopia/gallery/process.rb, line 36 def relative_path(media) source_path = media.path File.join(File.dirname(source_path), @name.to_s, File.basename(source_path)) end