Sha256: 4448fa9b5d8d7c3f7d39b9de3740de7554f5496d69babe4680fe00e6d3ca4250
Contents?: true
Size: 1.16 KB
Versions: 12
Compression:
Stored size: 1.16 KB
Contents
module Geminabox module Proxy class Splicer < FileHandler def self.make(file_name) splicer = new(file_name) splicer.create splicer end def create File.open(splice_path, 'w'){|f| f.write(new_content)} end def new_content if local_file_exists? merge_content else remote_content end end def splice_path proxy_path end def splice_folder_path proxy_folder_path end def splice_file_exists? file_exists? splice_path end def merge_content if gzip? merge_gziped_content else merge_text_content end end def gzip? /\.gz$/ =~ file_name end private def merge_gziped_content package(unpackage(local_content) | unpackage(remote_content)) end def unpackage(content) Marshal.load(Gem.gunzip(content)) end def package(content) Gem.gzip(Marshal.dump(content)) end def merge_text_content local_content.to_s + remote_content.to_s end end end end
Version data entries
12 entries across 12 versions & 3 rubygems