Sha256: 2d01586a619574f989ebd0e722d7a0b8f6810f81d4a743584cdc5351622b9d3c

Contents?: true

Size: 959 Bytes

Versions: 2

Compression:

Stored size: 959 Bytes

Contents

# frozen_string_literal: true

require('htx/malformed_template_error')
require('htx/template')
require('htx/version')

##
# A Ruby compiler for HTX templates.
#
module HTX
  EMPTY_HASH = {}.freeze

  ##
  # Convenience method to create a new Template instance and compile it.
  #
  def self.compile(name, template, options = EMPTY_HASH)
    Template.new(name, template).compile(**options)
  end

  ##
  # DEPRECATED. Use HTX::Template.new instead. HTX was formerly a class that would be instantiated for
  # compilation. This method allows HTX.new calls to continue working (but support will be removed in the
  # near future).
  #
  # * +name+ - Name of the template. Conventionally the path of the template file is used for the name,
  #   but it can be anything.
  # * +content+ - Template content string.
  #
  def self.new(name, content)
    warn('HTX.new is deprecated. Please use HTX::Template.new instead.')

    Template.new(name, content)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
htx-0.0.7 lib/htx.rb
htx-0.0.6 lib/htx.rb