class Schash::Schema::Rule::Type

Public Class Methods

new(klass) click to toggle source
# File lib/schash/schema/rule/type.rb, line 5
def initialize(klass)
  @klass = klass
end

Public Instance Methods

validate(target, position = []) click to toggle source
# File lib/schash/schema/rule/type.rb, line 9
def validate(target, position = [])
  errors = []

  unless target.is_a?(@klass)
    errors << Error.new(position, "is not #{@klass}")
  end

  errors
end