Class: CloudProviders::Ec2Helper

Inherits:
CloudProvider show all
Defined in:
lib/cloud_providers/ec2/helpers/ec2_helper.rb

Instance Attribute Summary

Attributes inherited from CloudProvider

#init_opts, #name

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CloudProvider

#after_initialized, #bootstrap_nodes!, #default_keypair_path, default_keypair_path, #method_missing, #run

Constructor Details

#initialize(name = cloud.proper_name, init_opts = {}, &block) ⇒ Ec2Helper

Returns a new instance of Ec2Helper.



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/cloud_providers/ec2/helpers/ec2_helper.rb', line 4

def initialize(name=cloud.proper_name, init_opts={}, &block)
  @name = name
  if name.is_a?(Hash)
    @name = name[:name]
    @init_opts = name if init_opts.empty?
  else
    @init_opts = init_opts
  end
  set_vars_from_options(init_opts)
  instance_eval &block if block
  after_initialized
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class CloudProviders::CloudProvider

Class Method Details

.property(*names) ⇒ Object



37
38
39
40
41
42
43
44
# File 'lib/cloud_providers/ec2/helpers/ec2_helper.rb', line 37

def self.property(*names)
  names.each do |name|
    define_method name do |*args|
      instance_variable_set("@#{name}", args.first) unless args.empty?
      instance_variable_get("@#{name}")
    end
  end
end

Instance Method Details

#asObject



25
26
27
# File 'lib/cloud_providers/ec2/helpers/ec2_helper.rb', line 25

def as
  cloud.as
end

#ec2Object



21
22
23
# File 'lib/cloud_providers/ec2/helpers/ec2_helper.rb', line 21

def ec2
  cloud.ec2
end

#elbObject



17
18
19
# File 'lib/cloud_providers/ec2/helpers/ec2_helper.rb', line 17

def elb
  cloud.elb
end

#poolObject



33
34
35
# File 'lib/cloud_providers/ec2/helpers/ec2_helper.rb', line 33

def pool
  cloud.parent
end

#rdsObject



29
30
31
# File 'lib/cloud_providers/ec2/helpers/ec2_helper.rb', line 29

def rds
  cloud.awsrds
end