class AttrStatements::Validations::Type

Constants

ERROR_KEY

Private Instance Methods

options() click to toggle source
# File lib/attr_statements/validations/type.rb, line 17
def options
  { class: statement.class_type }
end
validate_each(value) click to toggle source
# File lib/attr_statements/validations/type.rb, line 9
def validate_each(value)
  type_errors = []
  if value.present? && statement.class_type != value.class
    type_errors << Error.new(ERROR_KEY, options)
  end
  type_errors
end