Class: AwsInstanceList::Base
- Inherits:
-
Object
- Object
- AwsInstanceList::Base
- Defined in:
- lib/aws_instance_list/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#metric ⇒ Object
Returns the value of attribute metric.
-
#region ⇒ Object
Returns the value of attribute region.
Instance Method Summary collapse
- #demodulize ⇒ Object
-
#initialize(region: 'eu-west-1') ⇒ Base
constructor
A new instance of Base.
- #instances(options = {}) ⇒ Object
- #yaml ⇒ Object
- #yaml_default ⇒ Object
- #yaml_file ⇒ Object
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 ={} ds=descriptions() @instances+=ds.send( list_method ) if ds.marker [:marker]=ds.marker instances() 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_default ⇒ Object
34 35 36 |
# File 'lib/aws_instance_list/base.rb', line 34 def yaml_default YAML.load_file AwsInstanceList::DEFAULT_SETTINGS 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 |