Class: Shellject::Tasks::Save

Inherits:
Object
  • Object
show all
Includes:
CryptoTask
Defined in:
lib/shellject/tasks/save.rb

Overview

Encrypts and saves a file as a shelljection.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CryptoTask

#crypto

Constructor Details

#initialize(save_directory, input_path, name = nil) ⇒ Save

Returns a new instance of Save.



8
9
10
11
12
# File 'lib/shellject/tasks/save.rb', line 8

def initialize(save_directory, input_path, name = nil)
  @save_directory = save_directory
  @input_path = input_path
  @name = name
end

Instance Attribute Details

#input_pathObject (readonly)

Returns the value of attribute input_path.



6
7
8
# File 'lib/shellject/tasks/save.rb', line 6

def input_path
  @input_path
end

#save_directoryObject (readonly)

Returns the value of attribute save_directory.



6
7
8
# File 'lib/shellject/tasks/save.rb', line 6

def save_directory
  @save_directory
end

Instance Method Details

#callObject



14
15
16
17
18
19
20
# File 'lib/shellject/tasks/save.rb', line 14

def call
  ensure_readable
  ensure_writable
  with_files do |from, to|
    crypto.encrypt from, output: to
  end
end