Class: AwsInstanceList::Base
- Inherits:
-
Object
- Object
- AwsInstanceList::Base
show all
- Defined in:
- lib/aws_instance_list/base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(region: 'eu-west-1') ⇒ Base
Returns a new instance of Base.
9
10
11
12
13
14
15
16
17
|
# File 'lib/aws_instance_list/base.rb', line 9
def initialize region: 'eu-west-1'
@region=region
@metric = AwsInstanceList::Metric.new region: region
@instances = []
end
|
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
7
8
9
|
# File 'lib/aws_instance_list/base.rb', line 7
def client
@client
end
|
#metric ⇒ Object
Returns the value of attribute metric.
7
8
9
|
# File 'lib/aws_instance_list/base.rb', line 7
def metric
@metric
end
|
#region ⇒ Object
Returns the value of attribute region.
7
8
9
|
# File 'lib/aws_instance_list/base.rb', line 7
def region
@region
end
|
Instance Method Details
#demodulize ⇒ Object
42
43
44
|
# File 'lib/aws_instance_list/base.rb', line 42
def demodulize
self.class.name.split('::').last
end
|
#instances(options = {}) ⇒ Object
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/aws_instance_list/base.rb', line 19
def instances options={}
ds=descriptions(options)
@instances+=ds.send( list_method )
if ds.marker
options[:marker]=ds.marker
instances(options)
else
@instances
end
end
|
#yaml ⇒ Object
30
31
32
|
# File 'lib/aws_instance_list/base.rb', line 30
def yaml
@yaml||=yaml_default.merge(yaml_file)[demodulize]
end
|
#yaml_file ⇒ Object
38
39
40
|
# File 'lib/aws_instance_list/base.rb', line 38
def yaml_file
ENV.has_key?('AWS_INSTANCE_LIST_YAML') ? YAML.load_file(ENV['AWS_INSTANCE_LIST_YAML']) : {}
end
|