Sha256: 7b443c1483d1d4977e5e0ffc4c2e2b51b761244528bf234ec5ed757aab9bd1aa
Contents?: true
Size: 990 Bytes
Versions: 20
Compression:
Stored size: 990 Bytes
Contents
module BrowseEverythingHelper def array_to_hidden_fields(array,key) fields = array.to_query(key).split(Rack::Utils::DEFAULT_SEP).collect do |pair| key,value=pair.split('=', 2).map { |str| Rack::Utils.unescape(str) } hidden_field_tag(key,value) end fields.join("\n").html_safe end # Extracted from Rack::Mime 1.5.2 for use with earlier versions # of Rack/Rails def mime_match?(value, matcher) v1, v2 = value.split('/', 2) m1, m2 = matcher.split('/', 2) if m1 == '*' if m2.nil? || m2 == '*' return true elsif m2 == v2 return true else return false end end return false if v1 != m1 return true if m2.nil? || m2 == '*' m2 == v2 end def is_acceptable?(file) acceptable = params[:accept] || '*/*' acceptable_types = acceptable.split(/,\s*/) acceptable_types << 'application/x-directory' acceptable_types.any? { |type| mime_match?(file.type, type) } end end
Version data entries
20 entries across 20 versions & 1 rubygems