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.



10
11
12
13
# File 'lib/shellject/tasks/load.rb', line 10

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#save_directoryObject (readonly)

Returns the value of attribute save_directory.



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

def save_directory
  @save_directory
end

Instance Method Details

#callObject



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

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