Profile image for Hoang-Anh Le lha
Select an element from a collection with a given pattern
Language
Ruby
Tags
Fog Ruby

Select an element from a collection with a given pattern

1 # for example 2 3 # Find the Ehningen, Germany region 4 region = compute.locations.select {|loc| loc.location == "EHN"}.first 5 6 # Choose the 32-bit Copper image from the list of available instances for this image 7 instance_type = image.supported_instance_types.select {|img| img.label == 'Copper 32 bit'}.first

Comments