class Regexp

def to_json(*args)


{"json_class":"Regexp","o":0,"s":"foo"}

Output:

puts /foo/.to_json
require 'json/add/regexp'

Returns a JSON string representing +self+:
def to_json(*args)
  as_json.to_json(*args)
end