Package

com.gilt.handlebars.scala

helper

Permalink

package helper

Visibility
  1. Public
  2. All

Type Members

  1. class EachHelper[T] extends Helper[T]

    Permalink
  2. trait Helper[T] extends AnyRef

    Permalink

    The Scandlebars definition of a handlebars helper.

    The Scandlebars definition of a handlebars helper.

    The recommended fashion in which to define a helper is as follows. HelperOptions.lookup returns an Option which will evaluate to an empty string if the lookup does not yield a result.

    val fullNameHelper = Helper {
      (binding, options) =>
        "%s %s".format(options.lookup("firstName"), options.lookup("lastName"))
    }

    It may be likely that you can predict the type of binding in practice. You could attempt to cast the context binding to the type you expect. This runs the risk of throwing a ClassCastException while rendering the template, which may be desirable. Use cautiously.

    val fullNameHelper = Helper {
      (binding, options) =>
        val person = binding.asInstanceOf[Person]
        "%s %s".format(person.firstName, person.lastName)
    }

    See com.gilt.handlebars.scala.helper.HelperOptions for all of the options available.

  3. trait HelperOptions[T] extends AnyRef

    Permalink
  4. class HelperOptionsBuilder[T] extends Loggable

    Permalink
  5. class IfHelper[T] extends Helper[T] with Loggable

    Permalink
  6. class LogHelper[T] extends Helper[T] with Loggable

    Permalink
  7. class StaticHelper[T] extends Helper[T]

    Permalink
  8. class WithHelper[T] extends Helper[T] with Loggable

    Permalink

    with Helper

    with Helper

    Usage:

    {{with withContext}} {{!body}} {{/with}}

    Any mustache will be with respect to withContext not the context in which the helper was called.

Value Members

  1. object Helper

    Permalink

Ungrouped