Module: Meribah::Controller
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/meribah.rb
Instance Method Summary collapse
-
#meribah_send_data(data, options = {}) ⇒ Object
To send data, save data to a temporary file, then send.
-
#meribah_send_file(path, options = {}) ⇒ Object
To send a file, store options in the YML and then send them.
Instance Method Details
#meribah_send_data(data, options = {}) ⇒ Object
To send data, save data to a temporary file, then send
61 62 63 64 65 66 67 |
# File 'lib/meribah.rb', line 61 def meribah_send_data(data, ={}) file = File.open(Meribah::temp_file(), 'wb') file.write(data) file.close ::Meribah::TEMPFILES << file.path meribah_send_file(file.path,) end |
#meribah_send_file(path, options = {}) ⇒ Object
To send a file, store options in the YML and then send them
51 52 53 54 55 56 57 58 |
# File 'lib/meribah.rb', line 51 def meribah_send_file(path, ={}) yaml_file = File.open(Meribah::temp_file(),'w') yaml_file.write([path,].to_yaml) yaml_file.close session[:meribah_files] ||= [] session[:meribah_files] << File::basename(yaml_file.path) ::Meribah::TEMPFILES << yaml_file.path end |