Class: Basefile::FileHandler
- Inherits:
-
Object
- Object
- Basefile::FileHandler
- Defined in:
- lib/basefile/file_handler.rb
Instance Attribute Summary collapse
-
#filein ⇒ Object
Returns the value of attribute filein.
-
#fileout ⇒ Object
Returns the value of attribute fileout.
Instance Method Summary collapse
Instance Attribute Details
#filein ⇒ Object
Returns the value of attribute filein.
3 4 5 |
# File 'lib/basefile/file_handler.rb', line 3 def filein @filein end |
#fileout ⇒ Object
Returns the value of attribute fileout.
3 4 5 |
# File 'lib/basefile/file_handler.rb', line 3 def fileout @fileout end |
Instance Method Details
#decode_file(encoded_str) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/basefile/file_handler.rb', line 19 def decode_file(encoded_str) if @fileout == nil return false else File.open(@fileout, "wb") do |file| file.write(::Basefile::Base64Shim.decode(encoded_str)) end end end |
#encode_file ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/basefile/file_handler.rb', line 10 def encode_file if @filein == nil return false else f = File.open(@filein) return ::Basefile::Base64Shim.encode(f.read) end end |
#initalize(filein, fileout) ⇒ Object
5 6 7 8 |
# File 'lib/basefile/file_handler.rb', line 5 def initalize(filein, fileout) @filein = filein || nil @fileout = fileout || nil end |