Class: Cli
- Inherits:
-
Object
- Object
- Cli
- Defined in:
- lib/cli.rb
Instance Method Summary collapse
- #create_cipher(shift_amount, plaintext) ⇒ Object
- #display_encrypted_text(cipher) ⇒ Object
- #get_plain_text ⇒ Object
- #get_shift_amount ⇒ Object
-
#initialize ⇒ Cli
constructor
A new instance of Cli.
Constructor Details
#initialize ⇒ Cli
Returns a new instance of Cli.
4 5 6 7 8 9 |
# File 'lib/cli.rb', line 4 def initialize shift_amount = get_shift_amount plaintext = get_plain_text cipher = create_cipher(shift_amount, plaintext) display_encrypted_text(cipher) end |
Instance Method Details
#create_cipher(shift_amount, plaintext) ⇒ Object
21 22 23 |
# File 'lib/cli.rb', line 21 def create_cipher(shift_amount, plaintext) Cipher.new(shift_amount, plaintext) end |
#display_encrypted_text(cipher) ⇒ Object
25 26 27 |
# File 'lib/cli.rb', line 25 def display_encrypted_text(cipher) puts cipher.encrypt end |
#get_plain_text ⇒ Object
16 17 18 19 |
# File 'lib/cli.rb', line 16 def get_plain_text puts "What message do you want to encyrpt?" gets.chomp end |
#get_shift_amount ⇒ Object
11 12 13 14 |
# File 'lib/cli.rb', line 11 def get_shift_amount puts "What amount do you want to shift the cipher by? (0-25)" gets.chomp.to_i end |