Permalink
Browse files

doc: Grinder + new test format

  • Loading branch information...
MikeMitterer committed Dec 8, 2015
1 parent 6cdc2ff commit 965fa08ca09ac9dae3abeb799b9c44606759fe42
File renamed without changes.

This file was deleted.

Oops, something went wrong.
@@ -0,0 +1,39 @@
/*
* Copyright (c) 2015, Michael Mitterer (office@mikemitterer.at),
* IT-Consulting and Development Limited.
*
* All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

part of validate;

/// Helper to get the runtime-Info.
class instanceCheck<T> {
final bool _strict;

/// if strict is set to true List<String> == List comparison return false
instanceCheck({final bool strict: true }) : _strict = strict;

bool check(final obj) {
return (obj is T && _strict == false) || (_strict == true && obj is T && obj.runtimeType.toString() == type);
}

String get type {
final String type = this.runtimeType.toString().replaceFirst(new RegExp(r'[^<]+<'),'').replaceFirst(new RegExp(r'>$'),'');
//print("T $type");
return type;
}
}

Oops, something went wrong.

0 comments on commit 965fa08

Please sign in to comment.