Sha256: fe847d1dcece79f101765712cc17a64892d549f44b885bb32801fbd826efe42d

Contents?: true

Size: 441 Bytes

Versions: 4

Compression:

Stored size: 441 Bytes

Contents

require 'cf_sim/control_field_set'

class CfSim::CoexistableFieldMap
  include Enumerable

  def initialize(fields)
    @map = fields.each_with_object({}) do |field, map|
      map[field] = CfSim::ControlFieldSet.new(fields.reject { |other| field == other || field.intersected?(other) })
    end
  end

  def [](field)
    @map[field]
  end

  def each
    @map.each { |field, coexistable_fields| yield field, coexistable_fields }
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cf_sim-1.1.2 lib/cf_sim/coexistable_field_map.rb
cf_sim-1.1.1 lib/cf_sim/coexistable_field_map.rb
cf_sim-1.1.0 lib/cf_sim/coexistable_field_map.rb
cf_sim-1.0.0 lib/cf_sim/coexistable_field_map.rb