Sha256: c7f3ae4a27775def32d5356c8c50167c2c328f1b3fd01c11a57aeb2e15a0256f

Contents?: true

Size: 458 Bytes

Versions: 3

Compression:

Stored size: 458 Bytes

Contents

# frozen_string_literal: true

module Micro
  module Observers

    module Utils
      EMPTY_HASH = {}.freeze

      module Arrays
        def self.fetch_from_args(args)
          args.size == 1 && (first = args[0]).is_a?(::Array) ? first : args
        end

        def self.flatten_and_compact(value)
          return [] unless value

          array = Array(value).flatten
          array.compact!
          array
        end
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
u-observers-2.3.0 lib/micro/observers/utils.rb
u-observers-2.2.1 lib/micro/observers/utils.rb
u-observers-2.2.0 lib/micro/observers/utils.rb