Class: Partializer::Partials
- Inherits:
-
Object
- Object
- Partializer::Partials
show all
- Includes:
- Enumerable, PathHelper
- Defined in:
- lib/partializer/partials.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
(also: #path)
readonly
Returns the value of attribute name.
Instance Method Summary
collapse
Methods included from PathHelper
#build_path, #partial_path
Instance Attribute Details
#name ⇒ Object
Also known as:
path
Returns the value of attribute name.
8
9
10
|
# File 'lib/partializer/partials.rb', line 8
def name
@name
end
|
Instance Method Details
#<<(*partials) ⇒ Object
14
15
16
17
18
19
20
|
# File 'lib/partializer/partials.rb', line 14
def << *partials
@list ||= []
partials.flatten.each do |partial_name|
partial = Partializer::Partial.new(path, partial_name)
@list << partial
end
end
|
#each(&block) ⇒ Object
32
33
34
|
# File 'lib/partializer/partials.rb', line 32
def each &block
list.each {|item| yield item.name }
end
|
#initializer(list) ⇒ Object
10
11
12
|
# File 'lib/partializer/partials.rb', line 10
def initializer list
@list = list
end
|
#list ⇒ Object
28
29
30
|
# File 'lib/partializer/partials.rb', line 28
def list
@list ||= []
end
|
#set_context(ns, action) ⇒ Object
36
37
38
|
# File 'lib/partializer/partials.rb', line 36
def set_context ns, action
list.each {|p| p.send :set_context, ns, action }
end
|
#to_partial_path ⇒ Object
24
25
26
|
# File 'lib/partializer/partials.rb', line 24
def to_partial_path
path.gsub('.', '/')
end
|