Class: Regexp

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

Overview

Instance Method Summary collapse

Instance Method Details

#to_javascriptObject



4
5
6
# File 'lib/simple_form_with_client_validation/core_ext/regexp.rb', line 4

def to_javascript
  Regexp.new(inspect.sub('\\A','^').sub('\\Z','$').sub('\\z','$').sub(/^\//,'').sub(/\/[a-z]*$/,'').gsub(/\(\?#.+\)/, '').gsub(/\(\?-\w+:/,'('), self.options).inspect
end