Sha256: 3ed2a6c8e6118fde9fb438381873a9b2bea8acdea63798b78ad4ac7f3c220fd7
Contents?: true
Size: 980 Bytes
Versions: 11
Compression:
Stored size: 980 Bytes
Contents
module Jpmobile class PathSet < Array %w[initialize << concat insert push unshift].each do |method| class_eval <<-METHOD, __FILE__, __LINE__ + 1 def #{method}(*args) super typecast! end METHOD end 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 def find_all(*args) each do |resolver| templates = resolver.find_all(*args) return templates unless templates.empty? end [] end def exists?(*args) find_all(*args).any? end protected def typecast! each_with_index do |path, i| path = path.to_s if path.is_a?(Pathname) next unless path.is_a?(String) self[i] = Jpmobile::Resolver.new(path) end end end end
Version data entries
11 entries across 11 versions & 1 rubygems