Class: ActionView::Template::EagerPath

Inherits:
Path show all
Defined in:
lib/action_view/template.rb

Instance Attribute Summary

Attributes inherited from Path

#path, #paths

Instance Method Summary collapse

Methods inherited from Path

#==, #eql?, new_and_loaded, #to_s, #to_str

Constructor Details

#initialize(path) ⇒ EagerPath

Returns a new instance of EagerPath.



60
61
62
63
# File 'lib/action_view/template.rb', line 60

def initialize(path)
  super
  @loaded = false
end

Instance Method Details

#[](path) ⇒ Object



79
80
81
82
# File 'lib/action_view/template.rb', line 79

def [](path)
  load! unless @loaded
  @paths[path]
end

#load!Object



65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/action_view/template.rb', line 65

def load!
  return if @loaded

  @paths = {}
  templates_in_path do |template|
    template.load!
    template.accessible_paths.each do |path|
      @paths[path] = template
    end
  end
  @paths.freeze
  @loaded = true
end