Class: Shellject::Tasks::Load

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

Overview

Loads, decrypts, and outputs a shelljection

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CryptoTask

#crypto

Constructor Details

#initialize(save_directory, name) ⇒ Load

Returns a new instance of Load.



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

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#save_directoryObject (readonly)

Returns the value of attribute save_directory.



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

def save_directory
  @save_directory
end

Instance Method Details

#callObject



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

def call
  ensure_readable
  file = File.open path
  STDOUT.print crypto.decrypt(file)
ensure
  file.close if file
end