<commit_before># encoding: utf-8

module Adhearsion
  class CallController
    module Input

      Result = Struct.new(:response, :status, :menu)

      # Prompts for input via DTMF, handling playback of prompts,
      # timeouts, digit limits and terminator digits.
      #
      # @example A basic digit collection:
      #   ask "Welcome, ", "/opt/sounds/menu-prompt.mp3",
      #       :timeout => 10, :terminator => '#', :limit => 3 do |buffer|
      #     buffer == "12980"
      #   end
      #
      # The first arguments will be a list of sounds to play, as accepted by #play, including strings for TTS, Date and Time objects, and file paths.
      # :timeout, :terminator and :limit options may then be specified.
      # A block may be passed which is invoked on each digit being collected. If it returns true, the collection is terminated.
      #
      # @param [Object] A list of outputs to play, as accepted by #play
      # @param [Hash] options Options to use for the menu
      # @option options [Boolean] :interruptible If the prompt should be interruptible or not. Defaults to true
      # @option options [Integer] :limit Digit limit (causes collection to cease after a specified number of digits have been collected)
      # @option options [Integer] :timeout Timeout in seconds before the first and between each input digit
      # @option options [String] :terminator Digit to terminate input
      #
      # @return [Result] a result object from which the #response and #status may be established
      #
      # @see play
      # @see pass
      #
      def ask(*args, &block)
        options = args.last.kind_of?(Hash) ? args.pop : {}
        sound_files = args.flatten

        menu_instance = MenuDSL::Menu.new options do<commit_msg>[BUGFIX] #ask Result#to_s should be the result<commit_after># encoding: utf-8

module Adhearsion
  class CallController
    module Input

      Result = Struct.new(:response, :status, :menu) do
        def to_s
          response
        end
      end

      # Prompts for input via DTMF, handling playback of prompts,
      # timeouts, digit limits and terminator digits.
      #
      # @example A basic digit collection:
      #   ask "Welcome, ", "/opt/sounds/menu-prompt.mp3",
      #       :timeout => 10, :terminator => '#', :limit => 3 do |buffer|
      #     buffer == "12980"
      #   end
      #
      # The first arguments will be a list of sounds to play, as accepted by #play, including strings for TTS, Date and Time objects, and file paths.
      # :timeout, :terminator and :limit options may then be specified.
      # A block may be passed which is invoked on each digit being collected. If it returns true, the collection is terminated.
      #
      # @param [Object] A list of outputs to play, as accepted by #play
      # @param [Hash] options Options to use for the menu
      # @option options [Boolean] :interruptible If the prompt should be interruptible or not. Defaults to true
      # @option options [Integer] :limit Digit limit (causes collection to cease after a specified number of digits have been collected)
      # @option options [Integer] :timeout Timeout in seconds before the first and between each input digit
      # @option options [String] :terminator Digit to terminate input
      #
      # @return [Result] a result object from which the #response and #status may be established
      #
      # @see play
      # @see pass
      #
      def ask(*args, &block)
        options = args.last.kind_of?(Hash) ? args.pop : {}
        sound_files = args.flatten

        menu_instance = MenuDSL::Menu.new options do
{'fraction_non_alphanumeric': 0.08291873963515754, 'fraction_numerical': 0.00552791597567717, 'mean_word_length': 2.637185929648241, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4318519', 'n_tokens_mistral': 997, 'n_tokens_neox': 962, 'n_words': 431}