Sha256: 9c5f50e5a7251028044d6cf50962abdcb6bfbb89cf5908902b65abba501b5526

Contents?: true

Size: 410 Bytes

Versions: 2

Compression:

Stored size: 410 Bytes

Contents

module Brigadier
  module Validators
    module Base
      def initialize(obj)
        @obj = obj
      end

      def validate!
        raise Brigadier::Exceptions::Base.new(obj), failure_message unless valid?
      end

      private

        attr_reader :obj

        def value
          @value ||= obj.value
        end

        def valid?
          !obj.value.match(/poop/i)
        end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
brigadier-0.1.2 lib/brigadier/validators/base.rb
brigadier-0.1.1 lib/brigadier/validators/base.rb