module Azure::Helpers
Public Instance Methods
display_list(ui = nil, columns = [], rows = [])
click to toggle source
# File lib/azure/helpers.rb, line 29 def display_list(ui = nil, columns = [], rows = []) columns = columns.map { |col| ui.color(col, :bold) } count = columns.count rows = columns.concat(rows) puts "" puts ui.list(rows, :uneven_columns_across, count) end
msg_pair(ui = nil, label = nil, value = nil, color = :cyan)
click to toggle source
# File lib/azure/helpers.rb, line 37 def msg_pair(ui = nil, label = nil, value = nil, color = :cyan) if value && !value.to_s.empty? puts "#{ui.color(label, color)}: #{value}" end end
random_string(len = 10)
click to toggle source
# File lib/azure/helpers.rb, line 21 def random_string(len = 10) (0...len).map { 65.+(rand(25)).chr }.join end
strip_non_ascii(string)
click to toggle source
# File lib/azure/helpers.rb, line 25 def strip_non_ascii(string) string.gsub(/[^0-9a-z ]/i, "") end