Sha256: a67309ca8d3a401682f2145ba334561368978d2a68a5625054b2ceb7b095164d

Contents?: true

Size: 317 Bytes

Versions: 1

Compression:

Stored size: 317 Bytes

Contents

module SimpleValidate
  class ValidatesPresenceOf
    attr_reader :message
    attr_accessor :attribute

    def initialize(attribute, options)
      @message = options[:message] || "can't be empty"
      @attribute = attribute
    end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_validate-0.1.0 lib/simple_validate/validates_presence_of.rb