Class: ActionView::PathSet
- Inherits:
-
Object
- Object
- ActionView::PathSet
- Includes:
- Enumerable
- Defined in:
- lib/action_view/path_set.rb
Overview
Action View PathSet
Instance Attribute Summary collapse
-
#paths ⇒ Object
readonly
Returns the value of attribute paths.
Instance Method Summary collapse
- #+(array) ⇒ Object
- #[](i) ⇒ Object
- #compact ⇒ Object
- #each(&block) ⇒ Object
- #exists?(path, prefixes, *args) ⇒ Boolean
- #find(*args) ⇒ Object
- #find_all(path, prefixes = [], *args) ⇒ Object
- #find_file(path, prefixes = [], *args) ⇒ Object
- #include?(item) ⇒ Boolean
-
#initialize(paths = []) ⇒ PathSet
constructor
A new instance of PathSet.
- #initialize_copy(other) ⇒ Object
- #pop ⇒ Object
- #size ⇒ Object
- #to_ary ⇒ Object
Constructor Details
#initialize(paths = []) ⇒ PathSet
Returns a new instance of PathSet.
8 9 10 |
# File 'lib/action_view/path_set.rb', line 8 def initialize(paths = []) @paths = typecast paths end |
Instance Attribute Details
#paths ⇒ Object (readonly)
Returns the value of attribute paths.
6 7 8 |
# File 'lib/action_view/path_set.rb', line 6 def paths @paths end |
Instance Method Details
#+(array) ⇒ Object
45 46 47 |
# File 'lib/action_view/path_set.rb', line 45 def +(array) PathSet.new(paths + array) end |
#[](i) ⇒ Object
17 18 19 |
# File 'lib/action_view/path_set.rb', line 17 def [](i) paths[i] end |
#compact ⇒ Object
41 42 43 |
# File 'lib/action_view/path_set.rb', line 41 def compact PathSet.new paths.compact end |
#each(&block) ⇒ Object
37 38 39 |
# File 'lib/action_view/path_set.rb', line 37 def each(&block) paths.each(&block) end |
#exists?(path, prefixes, *args) ⇒ Boolean
69 70 71 |
# File 'lib/action_view/path_set.rb', line 69 def exists?(path, prefixes, *args) find_all(path, prefixes, *args).any? end |
#find(*args) ⇒ Object
57 58 59 |
# File '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
65 66 67 |
# File 'lib/action_view/path_set.rb', line 65 def find_all(path, prefixes = [], *args) _find_all path, prefixes, args, false end |
#find_file(path, prefixes = [], *args) ⇒ Object
61 62 63 |
# File 'lib/action_view/path_set.rb', line 61 def find_file(path, prefixes = [], *args) _find_all(path, prefixes, args, true).first || raise(MissingTemplate.new(self, path, prefixes, *args)) end |
#include?(item) ⇒ Boolean
25 26 27 |
# File 'lib/action_view/path_set.rb', line 25 def include?(item) paths.include? item end |
#initialize_copy(other) ⇒ Object
12 13 14 15 |
# File 'lib/action_view/path_set.rb', line 12 def initialize_copy(other) @paths = other.paths.dup self end |
#pop ⇒ Object
29 30 31 |
# File 'lib/action_view/path_set.rb', line 29 def pop paths.pop end |
#size ⇒ Object
33 34 35 |
# File 'lib/action_view/path_set.rb', line 33 def size paths.size end |
#to_ary ⇒ Object
21 22 23 |
# File 'lib/action_view/path_set.rb', line 21 def to_ary paths.dup end |