Class: Set
- Inherits:
-
Object
- Object
- Set
- Defined in:
- lib/l43/core/enum/set.rb
Instance Method Summary collapse
Instance Method Details
#fetch_any(*keys) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/l43/core/enum/set.rb', line 7 def fetch_any(*keys) keys = keys.flatten raise ArgumentError, "no keys provided to look for" if keys.empty? keys.each do |key| return L43::Core::Result.ok(true) if member? key end L43::Core::Result.error "none of #{keys.inspect} is a member of #{self}" end |
#fetch_any!(*keys) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/l43/core/enum/set.rb', line 18 def fetch_any!(*keys) case fetch_any(*keys) in :ok, result result in :error, error raise KeyError, error end end |