class Euca::Wrapper
Public Class Methods
new(type_id, columns = nil)
click to toggle source
# File lib/euca/wrapper.rb, line 4 def initialize type_id, columns = nil @type_id = type_id @columns = columns end
Public Instance Methods
parse(response)
click to toggle source
# File lib/euca/wrapper.rb, line 14 def parse response response.split("\n"). keep_if{ |line| line.match(/^#{@type_id}/i) }. map{ |line| rows = line.gsub("\n","").split("\t") @columns.nil? ? rows : Hash[ @columns.zip( rows ) ] } end
run(api, *args)
click to toggle source
# File lib/euca/wrapper.rb, line 9 def run api, *args raise NoMethodError.new("Euca#run: #{api} not found") and return false unless Euca.api_methods.include?(api) parse Euca.sh(:"euca-#{api}", *args).to_s end