File: regexp_ext.rb

package info (click to toggle)
ruby-character-set 1.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 416 kB
  • sloc: ansic: 2,597; ruby: 1,290; makefile: 7; sh: 4
file content (19 lines) | stat: -rw-r--r-- 396 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
class CharacterSet
  module CoreExt
    module RegexpExt
      def character_set
        CharacterSet.of_regexp(self)
      end

      def covered_by_character_set?(other)
        other.superset?(character_set)
      end

      def uses_character_set?(other)
        other.intersect?(character_set)
      end
    end
  end
end

::Regexp.instance_eval { include CharacterSet::CoreExt::RegexpExt }