Class: Cript::CriptCommand
- Inherits:
-
Object
- Object
- Cript::CriptCommand
- Defined in:
- lib/cript/cript_command.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(argv) ⇒ CriptCommand
constructor
A new instance of CriptCommand.
- #run! ⇒ Object
Constructor Details
#initialize(argv) ⇒ CriptCommand
Returns a new instance of CriptCommand.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/cript/cript_command.rb', line 9 def initialize(argv) @argv = argv.dup = { mode: nil, infile: '-', outfile: '-', public: File.join(ENV['HOME'], '.ssh/id_rsa.pub'), private: File.join(ENV['HOME'], '.ssh/id_rsa'), force: false, debug: false } parse! end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/cript/cript_command.rb', line 7 def end |
Instance Method Details
#run! ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/cript/cript_command.rb', line 25 def run! cripter = build_cripter data = read_data get_writer do |writer| if [:mode] == 'encrypt' writer.print cripter.encrypt(data) else writer.print cripter.decrypt(data) end end end |