Sha256: 4e6bff3b180c19a46448d44b3d815687f7a0bf7da69ca6b170f52a0867cf32d5

Contents?: true

Size: 628 Bytes

Versions: 8

Compression:

Stored size: 628 Bytes

Contents

module Formotion
  class InvalidClassError < StandardError; end
  class InvalidSectionError < StandardError; end

  class Conditions
    class << self
      def assert_nil_or_boolean(obj)
        if not (obj.nil? or obj.is_a? TrueClass or obj.is_a? FalseClass)
          raise Formotion::InvalidClassError, "#{obj.inspect} should be nil, true, or false, but is #{obj.class.to_s}"
        end
      end

      def assert_class(obj, klass)
        if not obj.is_a? klass
          raise Formotion::InvalidClassError, "#{obj.inspect} of class #{obj.class.to_s} is not of class #{klass.to_s}"
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
formotion-1.1.1 lib/formotion/exceptions.rb
formotion-1.1 lib/formotion/exceptions.rb
formotion-1.0 lib/formotion/exceptions.rb
formotion-0.5.1 lib/formotion/exceptions.rb
formotion-0.5 lib/formotion/exceptions.rb
formotion-0.0.3 lib/formotion/exceptions.rb
formotion-0.0.2 lib/formotion/exceptions.rb
formotion-0.0.1 lib/formotion/exceptions.rb