Class: ActionView::PathSet::Path
Overview
:nodoc:
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#paths ⇒ Object
readonly
Returns the value of attribute paths.
Class Method Summary collapse
Instance Method Summary collapse
- #==(path) ⇒ Object
- #[](path) ⇒ Object
- #eql?(path) ⇒ Boolean
-
#initialize(path, load = true) ⇒ Path
constructor
A new instance of Path.
- #load ⇒ Object
- #loaded? ⇒ Boolean
-
#reload! ⇒ Object
Rebuild load path directory cache.
Constructor Details
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
51 52 53 |
# File 'lib/action_view/paths.rb', line 51 def path @path end |
#paths ⇒ Object (readonly)
Returns the value of attribute paths.
51 52 53 |
# File 'lib/action_view/paths.rb', line 51 def paths @paths end |
Class Method Details
.eager_load_templates! ⇒ Object
43 44 45 |
# File 'lib/action_view/paths.rb', line 43 def self.eager_load_templates! @eager_load_templates = true end |
.eager_load_templates? ⇒ Boolean
47 48 49 |
# File 'lib/action_view/paths.rb', line 47 def self.eager_load_templates? @eager_load_templates || false end |
Instance Method Details
#==(path) ⇒ Object
60 61 62 |
# File 'lib/action_view/paths.rb', line 60 def ==(path) to_str == path.to_str end |
#[](path) ⇒ Object
68 69 70 71 |
# File 'lib/action_view/paths.rb', line 68 def [](path) raise "Unloaded view path! #{@path}" unless @loaded @paths[path] end |
#eql?(path) ⇒ Boolean
64 65 66 |
# File 'lib/action_view/paths.rb', line 64 def eql?(path) to_str == path.to_str end |
#load ⇒ Object
77 78 79 80 |
# File 'lib/action_view/paths.rb', line 77 def load reload! unless loaded? self end |
#loaded? ⇒ Boolean
73 74 75 |
# File 'lib/action_view/paths.rb', line 73 def loaded? @loaded ? true : false end |
#reload! ⇒ Object
Rebuild load path directory cache
83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/action_view/paths.rb', line 83 def reload! @paths = {} templates_in_path do |template| # Eager load memoized methods and freeze cached template template.freeze if self.class.eager_load_templates? @paths[template.path] = template @paths[template.path_without_extension] ||= template end @paths.freeze @loaded = true end |