Class: VagrantPlugins::ProfitBricks::Action::ListFlavors
- Inherits:
-
Object
- Object
- VagrantPlugins::ProfitBricks::Action::ListFlavors
- Defined in:
- lib/vagrant-profitbricks/action/list_flavors.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, _env) ⇒ ListFlavors
constructor
A new instance of ListFlavors.
Constructor Details
#initialize(app, _env) ⇒ ListFlavors
Returns a new instance of ListFlavors.
7 8 9 |
# File 'lib/vagrant-profitbricks/action/list_flavors.rb', line 7 def initialize(app, _env) @app = app end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/vagrant-profitbricks/action/list_flavors.rb', line 11 def call(env) compute_service = env[:profitbricks_compute] env[:ui].info format('%-36s %s', 'Flavor ID', 'Flavor Name') compute_service.flavors.sort_by(&:id).each do |flavor| env[:ui].info format('%-36s %s', flavor.id, flavor.name) end @app.call(env) end |