Class: Awsome::RequirementsOptions
- Inherits:
-
Object
- Object
- Awsome::RequirementsOptions
- Defined in:
- lib/awsome/requirements_options.rb
Instance Method Summary collapse
- #except_instance_ids ⇒ Object
- #filter_volume_ids(ids) ⇒ Object
- #find_volume(volume_id) ⇒ Object
-
#initialize(requirements) ⇒ RequirementsOptions
constructor
A new instance of RequirementsOptions.
- #only_volume_ids ⇒ Object
Constructor Details
#initialize(requirements) ⇒ RequirementsOptions
Returns a new instance of RequirementsOptions.
3 4 5 |
# File 'lib/awsome/requirements_options.rb', line 3 def initialize(requirements) @options = (requirements['options'] || {}).clone end |
Instance Method Details
#except_instance_ids ⇒ Object
9 10 11 |
# File 'lib/awsome/requirements_options.rb', line 9 def except_instance_ids (@options['except_instance_ids'] || []).to_set end |
#filter_volume_ids(ids) ⇒ Object
12 13 14 15 |
# File 'lib/awsome/requirements_options.rb', line 12 def filter_volume_ids(ids) ids = ids.to_set unless ids.is_a?(Set) only_volume_ids.any? ? only_volume_ids & ids : ids end |
#find_volume(volume_id) ⇒ Object
16 17 18 |
# File 'lib/awsome/requirements_options.rb', line 16 def find_volume(volume_id) @options['volumes'].find { |v| v['id'] == volume_id } end |
#only_volume_ids ⇒ Object
6 7 8 |
# File 'lib/awsome/requirements_options.rb', line 6 def only_volume_ids (@options['volumes'] || []).collect { |v| v['id'] }.to_set end |