Method: Jazzy::SourceKitten.attribute_regexp

Defined in:
lib/jazzy/sourcekitten.rb

.attribute_regexp(name) ⇒ Object

Regexp to match an @attribute. Complex to handle @available().



398
399
400
401
402
403
404
405
406
407
408
# File 'lib/jazzy/sourcekitten.rb', line 398

def self.attribute_regexp(name)
  qstring = /"(?:[^"\\]*|\\.)*"/
  %r{@#{name}      # @attr name
    (?:\s*\(       # optionally followed by spaces + parens,
      (?:          # containing any number of either..
        [^")]*|    # normal characters or...
        #{qstring} # quoted strings.
      )*           # (end parens content)
    \))?           # (end optional parens)
  }x
end