class Fog::Compute::AWS::Servers

Public Instance Methods

by_tag(tag, input) click to toggle source

Get servers matching given regex

# File lib/fog-pry/fog_client.rb, line 86
def by_tag(tag, input)
  if input.is_a? String
    running {|s| s.tags[tag] == input}
  elsif input.is_a? Regexp
    running {|s| s.tags[tag] =~ input}
  else
    raise "Unknown input object type: #{input.class}"
  end
end
method_missing(name, *args, &block) click to toggle source
Calls superclass method
# File lib/fog-pry/fog_client.rb, line 96
def method_missing(name, *args, &block)
  if name.match(/^by_/) && args.size == 1
    by_tag(name[3..-1], args[0])
  else
    super(name, *args, &block)
  end
end
running() { |s)| ... } click to toggle source
# File lib/fog-pry/fog_client.rb, line 77
def running(&block)
  if block_given?
    all.select{|s| s.ready? && (yield s)}
  else
    all.select{|s|s.ready?}
  end
end