class Bodhi::IsNotEmptyValidator

Public Class Methods

new(value) click to toggle source
# File lib/bodhi-slam/validators/not_empty.rb, line 4
def initialize(value); end

Public Instance Methods

to_options() click to toggle source
# File lib/bodhi-slam/validators/not_empty.rb, line 16
def to_options
  {self.to_sym => true}
end
validate(record, attribute, value) click to toggle source
# File lib/bodhi-slam/validators/not_empty.rb, line 6
def validate(record, attribute, value)
  unless value.nil?

    if value.is_a?(Array)
      record.errors.add(attribute, "must not be empty") if value.empty?
    end

  end
end