Class: Slidr::Commands::SaveToFileCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/slidr/commands/save_to_file_command.rb

Instance Method Summary collapse

Methods inherited from BaseCommand

#execute

Constructor Details

#initialize(path) ⇒ SaveToFileCommand

Returns a new instance of SaveToFileCommand.



6
7
8
# File 'lib/slidr/commands/save_to_file_command.rb', line 6

def initialize(path)
  @path = path
end

Instance Method Details

#go(content) ⇒ Object



10
11
12
13
14
15
# File 'lib/slidr/commands/save_to_file_command.rb', line 10

def go(content)
  File.open(@path, "w") do |file| 
    file.puts content
  end
  content
end