Sha256: 4ef28c4296c59ddb18bb3553de05b2bff8a04f5bfcc81e1ee6e7d1a18365e661
Contents?: true
Size: 642 Bytes
Versions: 1
Compression:
Stored size: 642 Bytes
Contents
require 'tempfile' require 'uri' module Dragonfly module Utils module_function def new_tempfile(ext=nil, content=nil) tempfile = ext ? Tempfile.new(['dragonfly', ".#{ext}"]) : Tempfile.new('dragonfly') tempfile.binmode tempfile.write(content) if content tempfile.close tempfile end def symbolize_keys(hash) hash.inject({}) do |new_hash, (key, value)| new_hash[key.to_sym] = value new_hash end end def uri_escape_segment(string) URI.escape(string).sub('/', '%2F') end def uri_unescape(string) URI.unescape(string) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dragonfly-0.9.14 | lib/dragonfly/utils.rb |