org.hyperscala.web.site.SessionContextualizable.scala Maven / Gradle / Ivy
package org.hyperscala.web.site
import language.reflectiveCalls
/**
* SessionContextualizable allows easy ability to iterate over and communicate to all instances of a specific
* Webpage type.
*
* @author Matt Hicks
*/
class SessionContextualizable[T <: Webpage](implicit manifest: Manifest[T]) {
def contextualize(f: T => Unit) = {
Website().sessions.valuesByType[T](manifest).foreach {
case page => {
page.context {
f(page)
}
}
}
}
}