Sha256: 157036982abe7a927055daddf56a5994a667434dacd32e6bdf7fc415dda97f94

Contents?: true

Size: 838 Bytes

Versions: 11

Compression:

Stored size: 838 Bytes

Contents

module MasterView
  class TemplateWatcher

    # check all the templates in the MIOTree to see if their mtimes
    # is newer than what we have saved in @@template_mtimes.
    # If newer, then run block and add path to array to be returned
    # If filename_pattern is specified then it will filter the results
    # returns array of paths that were newer
    def self.check_updated(template_mio_tree, filename_pattern, &block)
      template_paths_run = []
      template_mio_tree.find(:pattern => filename_pattern) do |mio|
        mtime = mio.mtime
        @@template_mtimes ||= {}
        unless @@template_mtimes[mio.pathname.to_s] == mtime
          yield mio
          @@template_mtimes[mio.pathname.to_s] = mtime
          template_paths_run << mio.pathname.to_s
        end
      end
      template_paths_run
    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
masterview-0.2.0 lib/masterview/extras/watcher.rb
masterview-0.2.1 lib/masterview/extras/watcher.rb
masterview-0.2.2 lib/masterview/extras/watcher.rb
masterview-0.2.3 lib/masterview/extras/watcher.rb
masterview-0.2.4 lib/masterview/extras/watcher.rb
masterview-0.2.5 lib/masterview/extras/watcher.rb
masterview-0.3.0 lib/masterview/extras/watcher.rb
masterview-0.3.1 lib/masterview/extras/watcher.rb
masterview-0.3.2 lib/masterview/extras/watcher.rb
masterview-0.3.3 lib/masterview/extras/watcher.rb
masterview-0.3.4 lib/masterview/extras/watcher.rb