class Schash::Schema::Rule::Match

Public Class Methods

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

Public Instance Methods

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

  unless @pattern.match(target)
    errors << Error.new(position, "does not match #{@pattern.inspect}")
  end

  errors
end