Class: Assh::Generator
- Inherits:
-
Object
- Object
- Assh::Generator
- Defined in:
- lib/generator.rb
Instance Attribute Summary collapse
-
#output_file ⇒ Object
Returns the value of attribute output_file.
Instance Method Summary collapse
-
#initialize(output_file = File.expand_path(Assh::GENERATED_CONFIG)) ⇒ Generator
constructor
A new instance of Generator.
- #run!(hosts) ⇒ Object
Constructor Details
#initialize(output_file = File.expand_path(Assh::GENERATED_CONFIG)) ⇒ Generator
Returns a new instance of Generator.
6 7 8 |
# File 'lib/generator.rb', line 6 def initialize(output_file = File.(Assh::GENERATED_CONFIG)) @output_file = output_file end |
Instance Attribute Details
#output_file ⇒ Object
Returns the value of attribute output_file.
4 5 6 |
# File 'lib/generator.rb', line 4 def output_file @output_file end |
Instance Method Details
#run!(hosts) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/generator.rb', line 10 def run!(hosts) File.open(@output_file, 'w') do |f| hosts.each do |_, host| f << host.to_ssh_config end end end |