Sha256: 7486a85e6b2141b9635cca51c5b872cba485febbc09522875b1c2944e64d5b90

Contents?: true

Size: 473 Bytes

Versions: 12

Compression:

Stored size: 473 Bytes

Contents

# frozen_string_literal: true

module Mihari
  module Schemas
    module Concerns
      #
      # OR-rable concern
      #
      module Orrable
        extend ActiveSupport::Concern

        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
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
mihari-7.3.0 lib/mihari/schemas/concerns/orrable.rb
mihari-7.2.0 lib/mihari/schemas/concerns/orrable.rb
mihari-7.1.3 lib/mihari/schemas/concerns/orrable.rb
mihari-7.1.2 lib/mihari/schemas/concerns/orrable.rb
mihari-7.1.1 lib/mihari/schemas/concerns/orrable.rb
mihari-7.1.0 lib/mihari/schemas/concerns/orrable.rb
mihari-7.0.5 lib/mihari/schemas/concerns/orrable.rb
mihari-7.0.4 lib/mihari/schemas/concerns/orrable.rb
mihari-7.0.3 lib/mihari/schemas/concerns/orrable.rb
mihari-7.0.2 lib/mihari/schemas/concerns/orrable.rb
mihari-7.0.1 lib/mihari/schemas/concerns/orrable.rb
mihari-7.0.0 lib/mihari/schemas/concerns/orrable.rb