class SSMD::Processors::Processor

Attributes

match[R]
options[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/ssmd/processors/processor.rb, line 5
def initialize(options = {})
  @options = options
end

Public Instance Methods

matches?(input) click to toggle source
# File lib/ssmd/processors/processor.rb, line 9
def matches?(input)
  @match = regex.match input

  !match.nil?
end
regex() click to toggle source
# File lib/ssmd/processors/processor.rb, line 31
def regex
  raise "subclass responsibility"
end
result() click to toggle source
# File lib/ssmd/processors/processor.rb, line 27
def result
  raise "subclass responsibility"
end
strip_ssmd(input) click to toggle source
# File lib/ssmd/processors/processor.rb, line 19
def strip_ssmd(input)
  join_parts match.pre_match, text, match.post_match if match
end
substitute(input) click to toggle source
# File lib/ssmd/processors/processor.rb, line 15
def substitute(input)
  join_parts match.pre_match, result, match.post_match if match
end
text() click to toggle source
# File lib/ssmd/processors/processor.rb, line 23
def text
  match.captures.first
end
warnings() click to toggle source
# File lib/ssmd/processors/processor.rb, line 35
def warnings
  @warnings ||= []
end

Private Instance Methods

join_parts(prefix, text, suffix) click to toggle source
# File lib/ssmd/processors/processor.rb, line 41
def join_parts(prefix, text, suffix)
  [prefix, text, suffix].join
end