Sha256: 68a023df516a19107df5ffcfe71cc7e30b25b2e5275d7728aac421eee4018eac

Contents?: true

Size: 531 Bytes

Versions: 1

Compression:

Stored size: 531 Bytes

Contents

module Polytrix
  class Validator
    UNIVERSAL_MATCHER = //
    attr_reader :suite, :sample, :callback

    def initialize(scope = {}, &validator)
      @suite = scope[:suite] ||= UNIVERSAL_MATCHER
      @sample = scope[:sample] ||= UNIVERSAL_MATCHER
      @callback = validator
    end

    def should_validate?(challenge)
      !!(@suite.match(challenge.suite) && @sample.match(challenge.name))
    end

    # def validate(challenge)
    #   instance_exec challenge, @callback if should_validate?(challenge)
    # end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
polytrix-0.1.0.pre lib/polytrix/validator.rb