class Opensaz::Package
Attributes
comment[R]
id[R]
request[R]
response[R]
Public Class Methods
new(id, ahash)
click to toggle source
# File lib/opensaz/package.rb, line 4 def initialize(id, ahash) @id = id @comment = ahash[:comment] 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)) end
Private Instance Methods
check_files(*files)
click to toggle source
# File lib/opensaz/package.rb, line 19 def check_files(*files) files.each{|x| raise "No such file: #{x}" unless File.exist?(x) } end
str_in_file(file)
click to toggle source
# File lib/opensaz/package.rb, line 23 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