Class: Slippers::TemplateGroupDirectory
- Inherits:
-
TemplateGroup
- Object
- TemplateGroup
- Slippers::TemplateGroupDirectory
- Defined in:
- lib/engine/template_group_directory.rb
Instance Attribute Summary collapse
-
#directory_paths ⇒ Object
readonly
Returns the value of attribute directory_paths.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean
- #find(subtemplate) ⇒ Object
- #has_registered?(class_name) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(directory_paths, params = {}) ⇒ TemplateGroupDirectory
constructor
A new instance of TemplateGroupDirectory.
- #render(item) ⇒ Object
Constructor Details
#initialize(directory_paths, params = {}) ⇒ TemplateGroupDirectory
Returns a new instance of TemplateGroupDirectory.
3 4 5 6 |
# File 'lib/engine/template_group_directory.rb', line 3 def initialize(directory_paths, params={}) @directory_paths = directory_paths @super_group = params[:super_group] end |
Instance Attribute Details
#directory_paths ⇒ Object (readonly)
Returns the value of attribute directory_paths.
7 8 9 |
# File 'lib/engine/template_group_directory.rb', line 7 def directory_paths @directory_paths end |
Instance Method Details
#eql?(other) ⇒ Boolean
26 27 28 29 |
# File 'lib/engine/template_group_directory.rb', line 26 def eql?(other) return false unless other directory_paths.eql?(other.directory_paths) end |
#find(subtemplate) ⇒ Object
9 10 11 12 13 |
# File 'lib/engine/template_group_directory.rb', line 9 def find(subtemplate) file_name = @directory_paths.map { |directory_path| directory_path + '/' + subtemplate + '.st' }.find { |f| File.exist? f} return Engine.new(FileTemplate.new(file_name).template, :template_group => self) if file_name find_renderer_or_supergroup(subtemplate) end |
#has_registered?(class_name) ⇒ Boolean
15 16 17 18 |
# File 'lib/engine/template_group_directory.rb', line 15 def has_registered?(class_name) return false unless @super_group @super_group.has_registered?(class_name) end |
#hash ⇒ Object
30 31 32 |
# File 'lib/engine/template_group_directory.rb', line 30 def hash @directory_paths.hash end |
#render(item) ⇒ Object
20 21 22 23 |
# File 'lib/engine/template_group_directory.rb', line 20 def render(item) return '' unless @super_group @super_group.render(item) end |