Sha256: 4201fadb0c96044a37fcdbb30b57ac93cd683009ff78d210bdb74685e3445657

Contents?: true

Size: 988 Bytes

Versions: 4

Compression:

Stored size: 988 Bytes

Contents

# frozen_string_literal: true

require 'ehbrs_ruby_utils/videos2/unsupported/checks'

module EhbrsRubyUtils
  module Videos2
    module Unsupported
      class CheckSet
        enable_simple_cache
        common_constructor :checks

        class << self
          # type: "file" or "track"
          def build(profiles, type)
            r = {}
            profiles.each do |profile|
              profile.send("#{type}_checks").each do |check|
                r[check] ||= CheckWithProfiles.new(check)
                r[check].add_profile(profile)
              end
            end
            new(r.values)
          end
        end

        class CheckWithProfiles < ::SimpleDelegator
          def initialize(check)
            super
            @profiles = []
          end

          def check_name
            __getobj__.class.name.demodulize
          end

          def add_profile(profile)
            @profiles << profile
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ehbrs_ruby_utils-0.44.3 lib/ehbrs_ruby_utils/videos2/unsupported/check_set.rb
ehbrs_ruby_utils-0.44.2 lib/ehbrs_ruby_utils/videos2/unsupported/check_set.rb
ehbrs_ruby_utils-0.44.1 lib/ehbrs_ruby_utils/videos2/unsupported/check_set.rb
ehbrs_ruby_utils-0.44.0 lib/ehbrs_ruby_utils/videos2/unsupported/check_set.rb