Sha256: f30e8a913c75467b3f62b1260c05c1bc4695840bab4a001c818b729989c7db82

Contents?: true

Size: 444 Bytes

Versions: 4

Compression:

Stored size: 444 Bytes

Contents

module SSMD::Processors
  class Processor
    attr_reader :match

    def matches?(input)
      @match = regex.match input

      !match.nil?
    end

    def substitute(input)
      if match
        match.pre_match + result + match.post_match
      end
    end

    def result
      raise "subclass responsibility"
    end

    def regex
      raise "subclass responsibility"
    end

    def warnings
      @warnings ||= []
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ssmd-0.2.2 lib/ssmd/processors/processor.rb
ssmd-0.2.1 lib/ssmd/processors/processor.rb
ssmd-0.2.0 lib/ssmd/processors/processor.rb
ssmd-0.1.0 lib/ssmd/processors/processor.rb