Class: Slippers::TemplateGroupDirectory

Inherits:
TemplateGroup show all
Defined in:
lib/engine/template_group_directory.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(directory_path, params = {}) ⇒ TemplateGroupDirectory

Returns a new instance of TemplateGroupDirectory.



3
4
5
6
# File 'lib/engine/template_group_directory.rb', line 3

def initialize(directory_path, params={})
  @directory_path = directory_path
  @super_group = params[:super_group]
end

Instance Attribute Details

#directory_pathObject (readonly)

Returns the value of attribute directory_path.



7
8
9
# File 'lib/engine/template_group_directory.rb', line 7

def directory_path
  @directory_path
end

Instance Method Details

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
29
# File 'lib/engine/template_group_directory.rb', line 26

def eql?(other)
  return false unless other
  directory_path.eql?(other.directory_path)
end

#find(subtemplate) ⇒ Object



9
10
11
12
13
14
# File 'lib/engine/template_group_directory.rb', line 9

def find(subtemplate)
  file_name = @directory_path + '/' + subtemplate + '.st'
  return find_renderer(subtemplate) unless File.exist?(file_name)
  Engine.new(FileTemplate.new(file_name).template, :template_group => self)
  
end

#has_registered?(class_name) ⇒ Boolean

Returns:

  • (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

#hashObject



30
31
32
# File 'lib/engine/template_group_directory.rb', line 30

def hash
  @directory_path.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