Class: Termit::SoundResponseHandler
- Inherits:
-
Object
- Object
- Termit::SoundResponseHandler
- Defined in:
- lib/termit/sound_response_handler.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(data) ⇒ SoundResponseHandler
constructor
A new instance of SoundResponseHandler.
Constructor Details
#initialize(data) ⇒ SoundResponseHandler
Returns a new instance of SoundResponseHandler.
6 7 8 |
# File 'lib/termit/sound_response_handler.rb', line 6 def initialize data @data = data end |
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/termit/sound_response_handler.rb', line 10 def call location = "#{File.('~')}/.termit" create_target_dir location File.open("#{location}/sound_response.mpeg", "wb") do |file| file.write(@data) end system "mpg123 -q #{location}/sound_response.mpeg" end |