Method: RDoc::Markup::AttributeManager#convert_regexp_handlings

Defined in:
lib/rdoc/markup/attribute_manager.rb

#convert_regexp_handlings(str, attrs, exclusive = false) ⇒ Object

Converts regexp handling sequences to RDoc attributes



223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/rdoc/markup/attribute_manager.rb', line 223

def convert_regexp_handlings str, attrs, exclusive = false
  @regexp_handlings.each do |regexp, attribute|
    next unless exclusive == exclusive?(attribute)
    str.scan(regexp) do
      capture = $~.size == 1 ? 0 : 1

      s, e = $~.offset capture

      attrs.set_attrs s, e - s, attribute | @attributes.regexp_handling
    end
  end
end