Class: Secrets::App::Outputs::ToFile
- Inherits:
-
Object
- Object
- Secrets::App::Outputs::ToFile
- Defined in:
- lib/secrets/app/outputs/to_file.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#cli ⇒ Object
Returns the value of attribute cli.
Instance Method Summary collapse
-
#initialize(cli) ⇒ ToFile
constructor
A new instance of ToFile.
- #opts ⇒ Object
- #output_proc ⇒ Object
Constructor Details
#initialize(cli) ⇒ ToFile
Returns a new instance of ToFile.
7 8 9 |
# File 'lib/secrets/app/outputs/to_file.rb', line 7 def initialize(cli) self.cli = cli end |
Instance Attribute Details
#cli ⇒ Object
Returns the value of attribute cli.
5 6 7 |
# File 'lib/secrets/app/outputs/to_file.rb', line 5 def cli @cli end |
Instance Method Details
#opts ⇒ Object
11 12 13 |
# File 'lib/secrets/app/outputs/to_file.rb', line 11 def opts cli.opts end |
#output_proc ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/secrets/app/outputs/to_file.rb', line 15 def output_proc ->(data) { File.open(opts[:output], 'w') { |f| f.write(data) } if opts[:verbose] puts %Q\File #{opts[:file].bold.green} (#{File.size(opts[:file])/1024}Kb) has been #{action}ypted.\ + "\n" + %Q\Encrypted version written to #{(opts[:output] || 'STDOUT').bold.green} (#{File.size(opts[:output]) / 1024}Kb)\ end } end |