Class: Oc::Run::Sizes
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
description, example, get_object_name, meta, method_added, option, options, summary, syntax
Instance Method Details
#run ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/system/run/commands/sizes.rb', line 5 def run result = .size.all if !result.success? puts "Error: #{result["error_message"]}".red else puts "Sizes".yellow rows = [] rows << [ 'ID', 'Memory', 'Disk', 'Cpu', 'Price (Monthly)', 'Price (Hourly)', ] result.sizes.each do |size| rows << [ size.slug, size.memory.to_s + " MB", size.disk.to_s + " GB", size.vcpus, "$ " + size.price_monthly.to_s, "$ " + size.price_hourly.to_s ] end table = Terminal::Table.new :rows => rows puts table end end |