Sha256: 0359645a31791b9008166d5048b13512f5134ad587aa0652f7250d04501428c9
Contents?: true
Size: 553 Bytes
Versions: 4
Compression:
Stored size: 553 Bytes
Contents
# frozen_string_literal: true module Micro module Observers class Event::Names EMPTY_ARRAY = [].freeze def self.[](value, default: EMPTY_ARRAY) values = Utils::Arrays.flatten_and_compact(value) values.empty? ? default : values end NO_EVENTS_MSG = 'no events (expected at least 1)'.freeze def self.fetch(value) values = self[value] return values unless values.empty? raise ArgumentError, NO_EVENTS_MSG end private_constant :NO_EVENTS_MSG end end end
Version data entries
4 entries across 4 versions & 1 rubygems