Sha256: 2351678f19ad685c6f2e3ffc0e249bcf6726e0d6a30dca52b7ecdcfe97e4618e

Contents?: true

Size: 1.11 KB

Versions: 28

Compression:

Stored size: 1.11 KB

Contents

# encoding: utf-8

module Adhearsion
  class CallController
    module MenuDSL
      class CalculatedMatch

        def self.failed_match!(pattern, query, match_payload)
          new :pattern => pattern, :query => query, :match_payload => match_payload
        end

        attr_reader :match_payload, :potential_matches, :exact_matches, :pattern, :query, :block

        def initialize(options = {})
          @pattern, @query, @match_payload, @block = options.values_at :pattern, :query, :match_payload, :block
          @potential_matches  = options[:potential_matches] ? Array(options[:potential_matches]) : []
          @exact_matches      = options[:exact_matches] ? Array(options[:exact_matches]) : []
        end

        def exact_match?
          exact_matches.any?
        end

        def potential_match?
          potential_matches.any?
        end

        def failed_match?
          !(potential_match? || exact_match?)
        end

        def type_of_match
          if exact_match?
            :exact
          elsif potential_match?
            :potential
          end
        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.rb
adhearsion-2.6.3 lib/adhearsion/call_controller/menu_dsl/calculated_match.rb
adhearsion-2.6.2 lib/adhearsion/call_controller/menu_dsl/calculated_match.rb
adhearsion-2.6.1 lib/adhearsion/call_controller/menu_dsl/calculated_match.rb
adhearsion-2.6.0 lib/adhearsion/call_controller/menu_dsl/calculated_match.rb
adhearsion-2.5.4 lib/adhearsion/call_controller/menu_dsl/calculated_match.rb
adhearsion-2.5.3 lib/adhearsion/call_controller/menu_dsl/calculated_match.rb
adhearsion-2.5.2 lib/adhearsion/call_controller/menu_dsl/calculated_match.rb
adhearsion-2.5.0 lib/adhearsion/call_controller/menu_dsl/calculated_match.rb
adhearsion-2.4.0 lib/adhearsion/call_controller/menu_dsl/calculated_match.rb
adhearsion-2.4.0.beta3 lib/adhearsion/call_controller/menu_dsl/calculated_match.rb
adhearsion-2.4.0.beta2 lib/adhearsion/call_controller/menu_dsl/calculated_match.rb
adhearsion-2.4.0.beta1 lib/adhearsion/call_controller/menu_dsl/calculated_match.rb
adhearsion-2.3.5 lib/adhearsion/call_controller/menu_dsl/calculated_match.rb
adhearsion-2.3.4 lib/adhearsion/call_controller/menu_dsl/calculated_match.rb
adhearsion-2.3.3 lib/adhearsion/call_controller/menu_dsl/calculated_match.rb
adhearsion-2.3.2 lib/adhearsion/call_controller/menu_dsl/calculated_match.rb
adhearsion-2.3.1 lib/adhearsion/call_controller/menu_dsl/calculated_match.rb
adhearsion-2.3.0 lib/adhearsion/call_controller/menu_dsl/calculated_match.rb
adhearsion-2.2.1 lib/adhearsion/call_controller/menu_dsl/calculated_match.rb