Sha256: eebb1ee129984623a89926171cbca1cb4a0cf3b440fb0cb6d4cb1434295401a9

Contents?: true

Size: 295 Bytes

Versions: 2

Compression:

Stored size: 295 Bytes

Contents

module SimpleValidate
  class ValidatesPresenceOf < ValidatesBase
    def initialize(attribute, options)
      super(attribute, options[:message] ||
        "can't be empty", options[:if] || proc { true })
    end

    def valid?(instance)
      !instance.send(attribute).nil?
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simple_validate-1.2.2 lib/simple_validate/validates_presence_of.rb
simple_validate-1.1.2 lib/simple_validate/validates_presence_of.rb