Sha256: 5f38bba1f8281b9b768bdff7c62fa07c92b407a7b7e141bc53cd5f4590d13107
Contents?: true
Size: 364 Bytes
Versions: 1
Compression:
Stored size: 364 Bytes
Contents
module SimpleValidate class ValidatesFormatOf attr_reader :message attr_accessor :attribute def initialize(attribute, options) @regex = options[:with] @message = options[:message] || 'is incorrect format' @attribute = attribute end def valid?(instance) !!(instance.send(attribute) =~ @regex) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
simple_validate-0.1.0 | lib/simple_validate/validates_format_of.rb |