Sha256: 75999721ad3a1159391329993c1e6f0a5daa9134ec7b9641b24dec41b16b778c

Contents?: true

Size: 1.21 KB

Versions: 28

Compression:

Stored size: 1.21 KB

Contents

# encoding: utf-8

module Adhearsion
  class CallController
    module MenuDSL
      class CalculatedMatchCollection
        attr_reader :calculated_matches, :potential_matches, :exact_matches,
          :actual_potential_matches, :actual_exact_matches

        def initialize
          @calculated_matches       = []
          @potential_matches        = []
          @exact_matches            = []
          @actual_potential_matches = []
          @actual_exact_matches     = []
        end

        def <<(calculated_match)
          calculated_matches << calculated_match
          actual_potential_matches.concat calculated_match.potential_matches
          actual_exact_matches.concat calculated_match.exact_matches

          potential_matches << calculated_match if calculated_match.potential_match?
          exact_matches << calculated_match if calculated_match.exact_match?
        end

        def potential_match_count
          actual_potential_matches.size
        end

        def exact_match_count
          actual_exact_matches.size
        end

        def potential_match?
          potential_match_count > 0
        end

        def exact_match?
          exact_match_count > 0
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
adhearsion-2.6.4 lib/adhearsion/call_controller/menu_dsl/calculated_match_collection.rb
adhearsion-2.6.3 lib/adhearsion/call_controller/menu_dsl/calculated_match_collection.rb
adhearsion-2.6.2 lib/adhearsion/call_controller/menu_dsl/calculated_match_collection.rb
adhearsion-2.6.1 lib/adhearsion/call_controller/menu_dsl/calculated_match_collection.rb
adhearsion-2.6.0 lib/adhearsion/call_controller/menu_dsl/calculated_match_collection.rb
adhearsion-2.5.4 lib/adhearsion/call_controller/menu_dsl/calculated_match_collection.rb
adhearsion-2.5.3 lib/adhearsion/call_controller/menu_dsl/calculated_match_collection.rb
adhearsion-2.5.2 lib/adhearsion/call_controller/menu_dsl/calculated_match_collection.rb
adhearsion-2.5.0 lib/adhearsion/call_controller/menu_dsl/calculated_match_collection.rb
adhearsion-2.4.0 lib/adhearsion/call_controller/menu_dsl/calculated_match_collection.rb
adhearsion-2.4.0.beta3 lib/adhearsion/call_controller/menu_dsl/calculated_match_collection.rb
adhearsion-2.4.0.beta2 lib/adhearsion/call_controller/menu_dsl/calculated_match_collection.rb
adhearsion-2.4.0.beta1 lib/adhearsion/call_controller/menu_dsl/calculated_match_collection.rb
adhearsion-2.3.5 lib/adhearsion/call_controller/menu_dsl/calculated_match_collection.rb
adhearsion-2.3.4 lib/adhearsion/call_controller/menu_dsl/calculated_match_collection.rb
adhearsion-2.3.3 lib/adhearsion/call_controller/menu_dsl/calculated_match_collection.rb
adhearsion-2.3.2 lib/adhearsion/call_controller/menu_dsl/calculated_match_collection.rb
adhearsion-2.3.1 lib/adhearsion/call_controller/menu_dsl/calculated_match_collection.rb
adhearsion-2.3.0 lib/adhearsion/call_controller/menu_dsl/calculated_match_collection.rb
adhearsion-2.2.1 lib/adhearsion/call_controller/menu_dsl/calculated_match_collection.rb