Class: Instance

Inherits:
Object
  • Object
show all
Defined in:
lib/sproutr/instance.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(instance) ⇒ Instance

Returns a new instance of Instance.



3
4
5
6
7
8
9
# File 'lib/sproutr/instance.rb', line 3

def initialize(instance)
  instance.keys.each do |key|
    var = "@#{key}"

    self.instance_variable_set(var.to_sym, instance[key])
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args, &block) ⇒ Object



16
17
18
# File 'lib/sproutr/instance.rb', line 16

def method_missing(sym, *args, &block)
  self.instance_variable_get "@#{sym}".to_sym
end

Class Method Details

.call_on(ec2, action, ami) ⇒ Object



11
12
13
14
# File 'lib/sproutr/instance.rb', line 11

def self.call_on(ec2, action, ami)
  
  ec2.call action, "InstanceId" => ami
end