Module: ViewComponent::CompileCache

Defined in:
lib/view_component/compile_cache.rb

Overview

Keeps track of which templates have already been compiled This isn’t part of the public API

Class Method Summary collapse

Class Method Details

.compiled?(klass) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/view_component/compile_cache.rb', line 17

def compiled?(klass)
  cache.include? klass
end

.invalidate!Object



26
27
28
# File 'lib/view_component/compile_cache.rb', line 26

def invalidate!
  cache.each { |klass| invalidate_class!(klass) }
end

.invalidate_class!(klass) ⇒ Object



21
22
23
24
# File 'lib/view_component/compile_cache.rb', line 21

def invalidate_class!(klass)
  cache.delete(klass)
  klass.compiler.reset_render_template_for
end

.register(klass) ⇒ Object



13
14
15
# File 'lib/view_component/compile_cache.rb', line 13

def register(klass)
  cache << klass
end