class Riserva::Commands::UploadFile
Public Class Methods
new(storage)
click to toggle source
Calls superclass method
Riserva::Commands::ApplicationCommand::new
# File lib/riserva/commands/upload_file.rb, line 3 def initialize(storage) super() @storage = storage end
Public Instance Methods
call(path)
click to toggle source
Calls superclass method
Riserva::Commands::ApplicationCommand#call
# File lib/riserva/commands/upload_file.rb, line 8 def call(path) broadcast(:start, "file: #{path} to #{@storage.title}...") return broadcast(:invalid) unless super success? ? broadcast(:ok, @path, @storage.title) : broadcast(:failed, @path) end
Private Instance Methods
success?()
click to toggle source
# File lib/riserva/commands/upload_file.rb, line 17 def success? upload && verify end
upload()
click to toggle source
# File lib/riserva/commands/upload_file.rb, line 21 def upload @storage.upload(@path, @path.basename) end
verify()
click to toggle source
# File lib/riserva/commands/upload_file.rb, line 25 def verify @storage.verify(@path.basename, @path) end