Sha256: a16068cb2e3f6e684b1829de79bb1ff33a8289c97ccf4509812f8b676affc19b

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

#
# Installs hooks to insert MasterView changed-template reparsing
# into the Rails request dispatching handler in ActionController::Base.
#
# Ensures that MasterView output files are always current while running a
# Rails application.  The <code>:rails_reparse_checking</code> option in the
# MasterView configuration should generally be enabled/disabled in conjunction
# with Rails class load caching, which is normally off in a development environment
# configuration.
#
# Requires that MasterView templates be parsed at application startup to properly
# initialize the mechanism for detecting template changes after application startup.
#

module ActionController #:nodoc:
  class Base #:nodoc
    # Install hook to enable MasterView to detect and automatically reparse
    # changed templates during Rails request dispatching.
    alias :process_pre_mv :process #:nodoc:
    def process(request, response, method = :perform_action, *arguments) #:nodoc:
      MasterView::TemplateWatcher.check_updated(MasterView::IOMgr.template, MasterView::TemplateFilenamePattern ) do |mio|
        MasterView::Parser.parse_mio( mio, MasterView::IOMgr.erb )
      end
      MasterView::AutoCopy.copy_all_updated_files
      process_pre_mv(request, response, method, *arguments)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
masterview-0.3.3 lib/masterview/rails_ext/action_controller_reparse_checking.rb
masterview-0.3.4 lib/masterview/rails_ext/action_controller_reparse_checking.rb