Class: ActionView::PathSet
Overview
Action View PathSet
This class is used to store and access paths in Action View. A number of operations are defined so that you can search among the paths in this set and also perform operations on other PathSet
objects.
A LookupContext
will use a PathSet
to store the paths in its context.
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Enumerable
#as_json, #exclude?, #index_by, #many?, #pluck, #sum, #without
Constructor Details
#initialize(paths = []) ⇒ PathSet
18
19
20
|
# File 'actionview/lib/action_view/path_set.rb', line 18
def initialize(paths = [])
@paths = typecast paths
end
|
Instance Attribute Details
Returns the value of attribute paths.
14
15
16
|
# File 'actionview/lib/action_view/path_set.rb', line 14
def paths
@paths
end
|
Instance Method Details
35
36
37
|
# File 'actionview/lib/action_view/path_set.rb', line 35
def +(array)
PathSet.new(paths + array)
end
|
31
32
33
|
# File 'actionview/lib/action_view/path_set.rb', line 31
def compact
PathSet.new paths.compact
end
|
#exists?(path, prefixes, *args) ⇒ Boolean
59
60
61
|
# File 'actionview/lib/action_view/path_set.rb', line 59
def exists?(path, prefixes, *args)
find_all(path, prefixes, *args).any?
end
|
#find(*args) ⇒ Object
47
48
49
|
# File 'actionview/lib/action_view/path_set.rb', line 47
def find(*args)
find_all(*args).first || raise(MissingTemplate.new(self, *args))
end
|
#find_all(path, prefixes = [], *args) ⇒ Object
55
56
57
|
# File 'actionview/lib/action_view/path_set.rb', line 55
def find_all(path, prefixes = [], *args)
_find_all path, prefixes, args, false
end
|
#find_all_with_query(query) ⇒ Object
63
64
65
66
67
68
69
70
|
# File 'actionview/lib/action_view/path_set.rb', line 63
def find_all_with_query(query) paths.each do |resolver|
templates = resolver.find_all_with_query(query)
return templates unless templates.empty?
end
[]
end
|
#find_file(path, prefixes = [], *args) ⇒ Object
51
52
53
|
# File 'actionview/lib/action_view/path_set.rb', line 51
def find_file(path, prefixes = [], *args)
_find_all(path, prefixes, args, true).first || raise(MissingTemplate.new(self, path, prefixes, *args))
end
|
#initialize_copy(other) ⇒ Object
22
23
24
25
|
# File 'actionview/lib/action_view/path_set.rb', line 22
def initialize_copy(other)
@paths = other.paths.dup
self
end
|
27
28
29
|
# File 'actionview/lib/action_view/path_set.rb', line 27
def to_ary
paths.dup
end
|