Sha256: c750318dd6becf5a3f1f04f6abd6add1e5dc17bdb128999e24fc97161d3b2088

Contents?: true

Size: 879 Bytes

Versions: 3

Compression:

Stored size: 879 Bytes

Contents

require 'active_support/core_ext/class/attribute'

module RubySpeech
  module GRXML
    class Element < Niceogiri::XML::Node
      def self.namespace
        GRXML_NAMESPACE
      end

      def self.root_element
        Grammar
      end

      def self.module
        GRXML
      end

      alias_method :nokogiri_children, :children

      include GenericElement

      def regexp_content # :nodoc:
        children.map(&:regexp_content).join
      end

      def potential_match?(other)
        false
      end

      def max_input_length
        0
      end

      def longest_potential_match(input)
        input.dup.tap do |longest_input|
          begin
            return longest_input if potential_match? longest_input
            longest_input.chop!
          end until longest_input.length.zero?
        end
      end
    end # Element
  end # GRXML
end # RubySpeech

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby_speech-1.0.1 lib/ruby_speech/grxml/element.rb
ruby_speech-1.0.0 lib/ruby_speech/grxml/element.rb
ruby_speech-0.5.1 lib/ruby_speech/grxml/element.rb