class ActionView::S3Resolver
Public Class Methods
new(path, pattern=nil)
click to toggle source
Calls superclass method
# File lib/erp_tech_svcs/file_support/railties/s3_resolver.rb, line 3 def initialize(path, pattern=nil) raise ArgumentError, "path already is a Resolver class" if path.is_a?(Resolver) super(pattern) @path = path end
Public Instance Methods
eql?(resolver)
click to toggle source
# File lib/erp_tech_svcs/file_support/railties/s3_resolver.rb, line 14 def eql?(resolver) self.class.equal?(resolver.class) && to_path == resolver.to_path end
Also aliased as: ==
get_dir_entries(path, file_support)
click to toggle source
# File lib/erp_tech_svcs/file_support/railties/s3_resolver.rb, line 60 def get_dir_entries(path, file_support) full_path = File.join(@path, path) node = file_support.find_node(File.dirname(full_path)) node.nil? ? [] : node[:children].select{|child| child[:leaf]}.collect{|child| child[:id]}.select{|p|!p.scan(full_path).empty?} end
mtime(p, file_support)
click to toggle source
# File lib/erp_tech_svcs/file_support/railties/s3_resolver.rb, line 66 def mtime(p, file_support) p = p.sub(%r{^/}, '') ErpTechSvcs::FileSupport::S3Manager.new.bucket.objects[p].last_modified end
query(path, details, formats)
click to toggle source
# File lib/erp_tech_svcs/file_support/railties/s3_resolver.rb, line 53 def query(path, details, formats) file_support = ErpTechSvcs::FileSupport::Base.new(:storage => :s3) templates = [] get_dir_entries(path, file_support).each{|p|templates << build_template(p, path.virtual, formats, file_support)} templates end
to_s()
click to toggle source
# File lib/erp_tech_svcs/file_support/railties/s3_resolver.rb, line 9 def to_s @path.to_s end
Also aliased as: to_path
Protected Instance Methods
build_template(p, virtual_path, formats, file_support, locals=nil)
click to toggle source
# File lib/erp_tech_svcs/file_support/railties/s3_resolver.rb, line 73 def build_template(p, virtual_path, formats, file_support, locals=nil) handler, format = extract_handler_and_format(p, formats) contents, message = file_support.get_contents(p) Template.new(contents, p, handler, :virtual_path => virtual_path, :format => format, :updated_at => mtime(p, file_support), :locals => locals) end