public function is($flag)
    {
        if (!isset($this->_detectors[$flag])) {
            return $flag === $this->format();
        }
        $detector = $this->_detectors[$flag];

        if (is_callable($detector)) {
            return $detector($this);
        }
        if (!is_array($detector)) {
            throw new Exception("Invalid `'{$flag}'` detector definition.");
        }
        $key = key($detector);
        $check = current($detector);
        $value = $this->attr($key);

        if (is_array($check)) {
            return !!preg_match('~' . join('|', $check) . '~i', $value);
        }
        if (preg_match('~^(?P<char>\~|/|@|#).*?(?P=char)$~', $check)) {
            return !!preg_match($check, $value);
        }
        return $check === $value;
    }