File: ext_adapter.rb

package info (click to toggle)
ruby-regexp-property-values 1.5.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 176 kB
  • sloc: ruby: 254; ansic: 76; makefile: 6; sh: 4
file content (25 lines) | stat: -rw-r--r-- 593 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
module RegexpPropertyValues
  class Value
    module ExtAdapter
      def matched_characters
        acc = []
        matched_codepoints.each do |cp|
          acc << cp.chr('utf-8') if cp < 0xD800 || cp > 0xDFFF
        end
        acc
      end

      def matched_codepoints
        OnigRegexpPropertyHelper.matched_codepoints(name)
      rescue ArgumentError
        raise_unsupported_or_unknown_error
      end

      def matched_ranges
        OnigRegexpPropertyHelper.matched_ranges(name)
      rescue ArgumentError
        raise_unsupported_or_unknown_error
      end
    end
  end
end