Sha256: b3d2d5e26d24123510c2b8996e962afeef2f08de72865acb289b7c24c4a95869
Contents?: true
Size: 792 Bytes
Versions: 1
Compression:
Stored size: 792 Bytes
Contents
module Opensaz class Package attr_reader :id, :request, :response, :miscel def initialize(id, ahash) @id = id requestf = File.join(ahash[:dest], ahash[:c]) responsef = File.join(ahash[:dest], ahash[:s]) check_files(requestf, responsef) @request = HTTPRequest.new(str_in_file(requestf)) @response = HTTPResponse.new(str_in_file(responsef)) # @miscel = HTTPMiscel.new(File.read(files[2])) end private def check_files(*files) files.each{|x| raise "No such file: #{x}" unless File.exist?(x) } end def str_in_file(file) # "b" is important. It won't change line endings. f = File.open(file, "rb") content = f.read f.close return content end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
opensaz-0.1.0 | lib/opensaz/package.rb |