Sha256: d35920f91da12843f91cc3948faca12482badbb86e273d9fa0b3931da9d52c19

Contents?: true

Size: 411 Bytes

Versions: 2

Compression:

Stored size: 411 Bytes

Contents

require "set"

require "membrane/errors"
require "membrane/schema/base"

module Membrane
  module Schema
  end
end

class Membrane::Schema::Bool < Membrane::Schema::Base
  TRUTH_VALUES = Set.new([true, false])

  def validate(object)
    if !TRUTH_VALUES.include?(object)
      emsg = "Expected instance of true or false, given #{object}"
      raise Membrane::SchemaValidationError.new(emsg)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
membrane-0.0.2 lib/membrane/schema/bool.rb
membrane-0.0.1 lib/membrane/schema/bool.rb