class AnyStyle::Feature::Brackets

Public Instance Methods

observe(token, **opts) click to toggle source
   # File lib/anystyle/feature/brackets.rb
 4 def observe(token, **opts)
 5   case token
 6   when /^[^\(\[<>\)\]]+$/
 7     :none
 8   when /^\(.*\)[,;:\p{Pd}\.]?$/
 9     :parens
10   when /^\[.*\][,;:\p{Pd}\.]?$/
11     :'square-brackets'
12   when /^<.*>[,;:\p{Pd}\.]?$/
13     :angle
14   when /\)[,;:\p{Pd}\.]?$/
15     :'closing-paren'
16   when /^\(/
17     :'opening-paren'
18   when /\][,;:\p{Pd}\.]?$/
19     :'closing-square-bracket'
20   when /^\[/
21     :'opening-square-bracket'
22   when />[,;:\p{Pd}\.]?$/
23     :'closing-angle'
24   when /^</
25     :'opening-angle'
26   else
27     :other
28   end
29 end