Module: Ace::LazyRendering

Defined in:
lib/ace/mixins/lazy.rb

Instance Method Summary collapse

Instance Method Details

#compare_mtime(one, others) ⇒ Object



10
11
12
# File 'lib/ace/mixins/lazy.rb', line 10

def compare_mtime(one, others)
  File.exist?(one) && File.mtime(one) > others.map { |post| File.mtime(post) }.max
end

#fresh?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/ace/mixins/lazy.rb', line 19

def fresh?
  @fresh ||= compare_mtime(self.output_path, self.source_files)
end

#save!Object



23
24
25
26
27
28
29
# File 'lib/ace/mixins/lazy.rb', line 23

def save!
  if self.fresh?
    puts "~ [IGNORE] #{self.output_path}"
  else
    super
  end
end

#source_filesObject



15
16
17
# File 'lib/ace/mixins/lazy.rb', line 15

def source_files
  [self.original_path]
end