Method: Regexp#to_json
- Defined in:
- lib/json/add/regexp.rb
#to_json(*args) ⇒ Object
Returns a JSON string representing self
:
require 'json/add/regexp'
puts /foo/.to_json
Output:
{"json_class":"Regexp","o":0,"s":"foo"}
45 46 47 |
# File 'lib/json/add/regexp.rb', line 45 def to_json(*args) as_json.to_json(*args) end |