Sha256: 70211c5cd20caab1cee70351d51208f447e0e9ccf61037086da96a8e73d85711

Contents?: true

Size: 591 Bytes

Versions: 18

Compression:

Stored size: 591 Bytes

Contents

module SSMD::Annotations
  class Annotation
    class << self
      def try(text)
        match = /\A#{regex}\Z/.match text

        if match
          new *match.captures
        end
      end

      def regex
        raise "subclass responsibility"
      end
    end

    def initialize
      raise "implement expecting one argumnt for each capture group in the regex"
    end

    def wrap(text)
      raise "wrap given text in resulting SSML element"
    end

    def combine(annotation)
      raise "combine this annotation with the given annotation of the same type"
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
ssmd-0.7.6 lib/ssmd/annotations/annotation.rb
ssmd-0.7.5 lib/ssmd/annotations/annotation.rb
ssmd-0.7.4 lib/ssmd/annotations/annotation.rb
ssmd-0.7.3 lib/ssmd/annotations/annotation.rb
ssmd-0.7.2 lib/ssmd/annotations/annotation.rb
ssmd-0.7.1 lib/ssmd/annotations/annotation.rb
ssmd-0.7.0 lib/ssmd/annotations/annotation.rb
ssmd-0.6.1 lib/ssmd/annotations/annotation.rb
ssmd-0.6.0 lib/ssmd/annotations/annotation.rb
ssmd-0.5.0 lib/ssmd/annotations/annotation.rb
ssmd-0.4.0 lib/ssmd/annotations/annotation.rb
ssmd-0.3.1 lib/ssmd/annotations/annotation.rb
ssmd-0.3.0 lib/ssmd/annotations/annotation.rb
ssmd-0.2.3 lib/ssmd/annotations/annotation.rb
ssmd-0.2.2 lib/ssmd/annotations/annotation.rb
ssmd-0.2.1 lib/ssmd/annotations/annotation.rb
ssmd-0.2.0 lib/ssmd/annotations/annotation.rb
ssmd-0.1.0 lib/ssmd/annotations/annotation.rb