Class: Jpmobile::PathSet

Inherits:
Array
  • Object
show all
Defined in:
lib/jpmobile/path_set.rb

Instance Method Summary collapse

Instance Method Details

#exists?(*args) ⇒ Boolean


26
27
28
# File 'lib/jpmobile/path_set.rb', line 26

def exists?(*args)
  find_all(*args).any?
end

#find(path, prefix = nil, partial = false, details = {}, key = nil) ⇒ Object

Raises:

  • (MissingTemplate)

12
13
14
15
16
# File 'lib/jpmobile/path_set.rb', line 12

def find(path, prefix = nil, partial = false, details = {}, key = nil)
  template = find_all(path, prefix, partial, details, key).first
  raise MissingTemplate.new(self, "#{prefix}/#{path}", details, partial) unless template
  template
end

#find_all(*args) ⇒ Object


18
19
20
21
22
23
24
# File 'lib/jpmobile/path_set.rb', line 18

def find_all(*args)
  each do |resolver|
    templates = resolver.find_all(*args)
    return templates unless templates.empty?
  end
  []
end