class Ahnnotate::Function::StripSchema
Attributes
comment[R]
Public Class Methods
new(comment:)
click to toggle source
# File lib/ahnnotate/function/strip_schema.rb, line 6 def initialize(comment:) @comment = comment end
Public Instance Methods
call(content)
click to toggle source
# File lib/ahnnotate/function/strip_schema.rb, line 10 def call(content) matches = pattern.match(content) if matches matches["post"] else content end end
Private Instance Methods
pattern()
click to toggle source
# File lib/ahnnotate/function/strip_schema.rb, line 22 def pattern @pattern ||= begin newline = /\r?\n\r?/ /\A#{comment}\s==\sSchema\sInfo(?:rmation)?#{newline}?(?:^#{comment}[^\n]*$#{newline})*#{newline}(?<post>.*)/m end end