I read The Neophyte's Guide to Scala Part 5: The Option Type and he suggested that a way to match on options. I implemented his suggestion here:
s3Bucket match {
case Some(bucket) =>
bucket.putObject(partOfKey + key + file.getName, file)
true
case None =>
false
}
But I have some questions on how it actually works. Namely, since s3Bucket is of type Option[Bucket], how does case Some(bucket) unwrap s3Bucket into bucket? What exactly is going on under the hood?