Skip to content

Commit

Permalink
Unpack tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
laurilehmijoki committed Jan 5, 2015
1 parent 32991d2 commit b49639f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/main/scala/s3/website/model/push.scala
Expand Up @@ -80,14 +80,16 @@ case class Upload(originalFile: File, uploadType: UploadType)(implicit site: Sit
.right.map(respectMostSpecific)
.fold(
(seconds: Int) => Some(seconds),
(globs: GlobsSeq) =>
globs.find { globAndInt =>
(rubyRuntime evalScriptlet
(globs: GlobsSeq) => {
val matchingMaxAge = (glob: String, maxAge: Int) =>
rubyRuntime.evalScriptlet(
s"""|# encoding: utf-8
|File.fnmatch('${globAndInt._1}', '$s3Key')""".stripMargin)
|File.fnmatch('$glob', '$s3Key')""".stripMargin)
.toJava(classOf[Boolean])
.asInstanceOf[Boolean]
} map (_._2)
val fileGlobMatch = globs find Function.tupled(matchingMaxAge)
fileGlobMatch map (_._2)
}
)
}
}
Expand Down

0 comments on commit b49639f

Please sign in to comment.