Class: ActionView::PathSet
Overview
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Enumerable
#as_json, #each_with_object, #exclude?, #group_by, #index_by, #many?, #sum
Constructor Details
#initialize(paths = []) ⇒ PathSet
Returns a new instance of PathSet.
8
9
10
|
# File 'actionpack/lib/action_view/path_set.rb', line 8
def initialize(paths = [])
@paths = typecast paths
end
|
Instance Attribute Details
Returns the value of attribute paths
6
7
8
|
# File 'actionpack/lib/action_view/path_set.rb', line 6
def paths
@paths
end
|
Instance Method Details
45
46
47
|
# File 'actionpack/lib/action_view/path_set.rb', line 45
def +(array)
PathSet.new(paths + array)
end
|
17
18
19
|
# File 'actionpack/lib/action_view/path_set.rb', line 17
def [](i)
paths[i]
end
|
41
42
43
|
# File 'actionpack/lib/action_view/path_set.rb', line 41
def compact
PathSet.new paths.compact
end
|
#each(&block) ⇒ Object
37
38
39
|
# File 'actionpack/lib/action_view/path_set.rb', line 37
def each(&block)
paths.each(&block)
end
|
#exists?(path, prefixes, *args) ⇒ Boolean
72
73
74
|
# File 'actionpack/lib/action_view/path_set.rb', line 72
def exists?(path, prefixes, *args)
find_all(path, prefixes, *args).any?
end
|
#find(*args) ⇒ Object
57
58
59
|
# File 'actionpack/lib/action_view/path_set.rb', line 57
def find(*args)
find_all(*args).first || raise(MissingTemplate.new(self, *args))
end
|
#find_all(path, prefixes = [], *args) ⇒ Object
61
62
63
64
65
66
67
68
69
70
|
# File 'actionpack/lib/action_view/path_set.rb', line 61
def find_all(path, prefixes = [], *args)
prefixes = [prefixes] if String === prefixes
prefixes.each do |prefix|
paths.each do |resolver|
templates = resolver.find_all(path, prefix, *args)
return templates unless templates.empty?
end
end
[]
end
|
#include?(item) ⇒ Boolean
25
26
27
|
# File 'actionpack/lib/action_view/path_set.rb', line 25
def include?(item)
paths.include? item
end
|
#initialize_copy(other) ⇒ Object
12
13
14
15
|
# File 'actionpack/lib/action_view/path_set.rb', line 12
def initialize_copy(other)
@paths = other.paths.dup
self
end
|
29
30
31
|
# File 'actionpack/lib/action_view/path_set.rb', line 29
def pop
paths.pop
end
|
33
34
35
|
# File 'actionpack/lib/action_view/path_set.rb', line 33
def size
paths.size
end
|
21
22
23
|
# File 'actionpack/lib/action_view/path_set.rb', line 21
def to_ary
paths.dup
end
|