Class: Regexp

Inherits:
Object
  • Object
show all
Defined in:
lib/client_side_validations/core_ext/regexp.rb

Instance Method Summary collapse

Instance Method Details

#as_json(options = nil) ⇒ Object



2
3
4
# File 'lib/client_side_validations/core_ext/regexp.rb', line 2

def as_json(options = nil)
  Regexp.new inspect.sub("\\A","^").sub("\\Z","$").sub("\\z","$").sub(/^\//,"").sub(/\/[a-z]*$/,""), self.options
end

#encode_json(encoder) ⇒ Object



10
11
12
# File 'lib/client_side_validations/core_ext/regexp.rb', line 10

def encode_json(encoder)
  inspect
end

#to_json(options = nil) ⇒ Object



6
7
8
# File 'lib/client_side_validations/core_ext/regexp.rb', line 6

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