Parent

Class/Module Index [+]

Quicksearch

ActionView::ReloadableTemplate

Attributes

previously_last_modified[RW]

Public Class Methods

new(*args) click to toggle source
# File lib/action_view/reloadable_template.rb, line 80
def initialize(*args)
  super
  
  # we don't ever want to get frozen
  extend Unfreezable
end

Public Instance Methods

mtime() click to toggle source
# File lib/action_view/reloadable_template.rb, line 87
def mtime
  File.mtime(filename)
end
reset_cache_if_stale!() click to toggle source
# File lib/action_view/reloadable_template.rb, line 100
def reset_cache_if_stale!
  if stale?
    flush_cache 'source', 'compiled_source'
    undef_my_compiled_methods!
    @previously_last_modified = mtime
  end
  self
end
stale?() click to toggle source
# File lib/action_view/reloadable_template.rb, line 93
def stale?
  previously_last_modified.nil? || previously_last_modified < mtime
rescue Errno::ENOENT => e
  undef_my_compiled_methods!
  raise TemplateDeleted
end
undef_my_compiled_methods!() click to toggle source

remove any compiled methods that look like they might belong to me

# File lib/action_view/reloadable_template.rb, line 110
def undef_my_compiled_methods!
  ActionView::Base::CompiledTemplates.public_instance_methods.grep(/#{Regexp.escape(method_name_without_locals)}(?:_locals_)?/).each do |m|
    ActionView::Base::CompiledTemplates.send(:remove_method, m)
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.