# File lib/json/jwt.rb, line 82 def decode_compact_serialized(jwt_string, key_or_secret, algorithms = nil, encryption_methods = nil) case jwt_string.count('.') + 1 when JWS::NUM_OF_SEGMENTS JWS.decode_compact_serialized jwt_string, key_or_secret, algorithms when JWE::NUM_OF_SEGMENTS JWE.decode_compact_serialized jwt_string, key_or_secret, algorithms, encryption_methods else raise InvalidFormat.new("Invalid JWT Format. JWT should include #{JWS::NUM_OF_SEGMENTS} or #{JWE::NUM_OF_SEGMENTS} segments.") end end