Class: Rgc::Keygen
- Inherits:
-
Object
- Object
- Rgc::Keygen
- Defined in:
- lib/rgc/keygen.rb
Instance Method Summary collapse
-
#initialize(global_options, options, args) ⇒ Keygen
constructor
A new instance of Keygen.
Constructor Details
#initialize(global_options, options, args) ⇒ Keygen
Returns a new instance of Keygen.
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/rgc/keygen.rb', line 3 def initialize(, , args) if File.exists?(path = args.first) abort "Key file already exists." end begin File.open(path, 'w') do |f| f.write(generate_secure_key) end rescue abort "Cannot open #{path} for writing." end end |