Sha256: 5cca253e8405516e916336ab1f023844cf2d9f3b7f1e21d272e055e1fb91c767

Contents?: true

Size: 383 Bytes

Versions: 7

Compression:

Stored size: 383 Bytes

Contents

# frozen_string_literal: true

module Mihari
  module Schemas
    #
    # Mixins for schemas
    #
    module Mixins
      def get_or_composition
        schemas = constants.map { |sym| const_get sym }
        return schemas.first if schemas.length <= 1

        base, *others = schemas
        others.each { |other| base = base.or(other) }

        base
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mihari-6.3.0 lib/mihari/schemas/mixins.rb
mihari-6.2.0 lib/mihari/schemas/mixins.rb
mihari-6.1.0 lib/mihari/schemas/mixins.rb
mihari-6.0.0 lib/mihari/schemas/mixins.rb
mihari-5.7.2 lib/mihari/schemas/mixins.rb
mihari-5.7.1 lib/mihari/schemas/mixins.rb
mihari-5.7.0 lib/mihari/schemas/mixins.rb