public static function parse($range)
    {
        $matches = array();

        if (preg_match(self::REGEX, $range, $matches) !== 1) {
            throw new InvalidArgumentException(sprintf('Provided range "%s" does not match Ruby syntax.', $range));
        }

        return new self($matches[1] + 0, $matches[3] + 0, $matches[2] === '.');
    }