File: regexp.rb

package info (click to toggle)
ruby-client-side-validations 23.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 272 kB
  • sloc: ruby: 788; javascript: 671; makefile: 2
file content (17 lines) | stat: -rw-r--r-- 222 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

require 'js_regex'

class Regexp
  def as_json(*)
    JsRegex.new(self).to_h
  end

  def to_json(options = nil)
    as_json(options)
  end

  def encode_json(_encoder)
    inspect
  end
end