Sha256: c5e679e9ed39e66c03e5b07e4d8b54e738b3177c7b6d107e5bcbec6a05832658
Contents?: true
Size: 794 Bytes
Versions: 1
Compression:
Stored size: 794 Bytes
Contents
class Regexp def to_javascript Regexp.new(inspect.sub('\\A','^').sub('\\Z','$').sub('\\z','$').sub(/^\//,'').sub(/\/[a-z]*$/,'').gsub(/\(\?#.+\)/, '').gsub(/\(\?-\w+:/,'('), self.options).inspect end end module BootstrapValidatorRails module Validators class Format def initialize(record, method, validator) @record, @method, @validator = record, method, validator end def generate_data data = {} options = @validator.options regex = options[:with].to_javascript data[:bv_regexp] = 'true' if options[:with] data[:bv_regexp_regexp] = regex end if options[:message] data[:bv_regexp_message] = options[:message] end data end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bootstrap_validator_rails-0.4.0 | lib/bootstrap_validator_rails/validators/format_validator.rb |