Module: Lambda::MicroVMs::Util
- Defined in:
- lib/lambda/microvms/util.rb
Overview
Internal helpers shared by resource objects.
Class Method Summary collapse
Class Method Details
.extract(value, *keys) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/lambda/microvms/util.rb', line 9 def extract(value, *keys) keys.each do |key| if value.respond_to?(key) result = value.public_send(key) return result unless result.nil? end next unless value.respond_to?(:[]) begin result = value[key] return result unless result.nil? rescue KeyError, TypeError nil end end nil end |
.normalize_state(value) ⇒ Object
29 30 31 |
# File 'lib/lambda/microvms/util.rb', line 29 def normalize_state(value) value.to_s.downcase.to_sym end |