Class: Awsum::Ec2::Region
Instance Attribute Summary collapse
-
#end_point ⇒ Object
readonly
Returns the value of attribute end_point.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#availability_zones ⇒ Object
List the AvailabilityZone(s) of this Region.
-
#initialize(ec2, name, end_point) ⇒ Region
constructor
:nodoc:.
-
#use(&block) ⇒ Object
Operate all Awsum::Ec2 methods against this Region.
Constructor Details
#initialize(ec2, name, end_point) ⇒ Region
:nodoc:
6 7 8 9 10 |
# File 'lib/ec2/region.rb', line 6 def initialize(ec2, name, end_point) #:nodoc: @ec2 = ec2 @name = name @end_point = end_point end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object (private)
– Will pass all missing methods onto the ec2 object
38 39 40 |
# File 'lib/ec2/region.rb', line 38 def method_missing(method_name, *args, &block) @ec2.send(method_name, *args, &block) end |
Instance Attribute Details
#end_point ⇒ Object (readonly)
Returns the value of attribute end_point.
4 5 6 |
# File 'lib/ec2/region.rb', line 4 def end_point @end_point end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/ec2/region.rb', line 4 def name @name end |
Instance Method Details
#availability_zones ⇒ Object
List the AvailabilityZone(s) of this Region
13 14 15 |
# File 'lib/ec2/region.rb', line 13 def availability_zones @ec2.availability_zones end |
#use(&block) ⇒ Object
Operate all Awsum::Ec2 methods against this Region
Example
ec2.region('eu-west-1').use do
#Runs an instance within the eu-west-1 region
instance = run_instances('i-ABCDEF')
end
25 26 27 28 29 30 31 32 33 |
# File 'lib/ec2/region.rb', line 25 def use(&block) old_host = @ec2.host @ec2.host = end_point if block block.arity < 1 ? instance_eval(&block) : block[self] end @ec2.host = old_host self end |