File: ext_adapter.rb

package info (click to toggle)
ruby-regexp-property-values 1.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 164 kB
  • sloc: ruby: 243; ansic: 51; makefile: 6; sh: 4
file content (19 lines) | stat: -rw-r--r-- 417 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module RegexpPropertyValues
  class Value
    module ExtAdapter
      def matched_characters
        matched_codepoints.map { |cp| cp.chr('utf-8') }
      end

      def matched_codepoints
        matched_ranges.flat_map(&:to_a)
      end

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