Method: Irc::NetmaskDb#cook_component
- Defined in:
- lib/rbot/maskdb.rb
#cook_component(str) ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/rbot/maskdb.rb', line 105 def cook_component(str) s = (str && !str.empty?) ? str : '*' l = s.index(/[\?\*]/) if l l2 = s.size - s.rindex(/[\?\*]/) - 1 if l2 > l s = s.reverse l = l2 end return (l > 0) ? s.slice(0 .. (l - 1)) : '' else return s end end |