Sha256: 04d8af539f2ee8982678f9bd81772b8b5a3aa56f0a9e0184ef4788d0027739a7
Contents?: true
Size: 658 Bytes
Versions: 1
Compression:
Stored size: 658 Bytes
Contents
# frozen_string_literal: true module Handlebarsjs # Extend base helper for each of your custom handlebars-helpers class BaseHelper # Wrap the parse method in a handlebars context aware block # and return as a lambda/proc so that it is available to the # Handlebars template engine def to_proc ->(value, _opts) { wrapper(parse(value)) } end # All child classes will generally implement this method def parse(value) value end # If you need to wrap the return value in a specific # Handlebars Type, eg. SafeString, then you can override this method def wrapper(value) value end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
handlebarsjs-0.5.0 | lib/handlebarsjs/base_helper.rb |