Sha256: 8168e8754dcc14fbe55d07b58fbab7e018fe0c3bb06fd2d246a9c5e68dd2ccb4

Contents?: true

Size: 683 Bytes

Versions: 1

Compression:

Stored size: 683 Bytes

Contents

# frozen_string_literal: true

module Handlebarsjs
  # handlebars.handlebars_snapshot.add_helper(helper_name, helper)
  # Structure for storing Cmdlet configuration
  class HandlebarsConfiguration
    include KLog::Logging

    attr_accessor :helpers
    attr_reader :defaults

    def initialize
      @helpers = []
      @defaults = Handlebarsjs::HandlebarsConfigurationDefaults.new
    end

    HelperConfig = Struct.new(:name, :helper)

    def helper(name, helper, aliases: [])
      names = [name.to_sym]
      names = (names + aliases.map(&:to_sym)).uniq

      names.each do |helper_name|
        @helpers << HelperConfig.new(helper_name, helper)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
handlebarsjs-0.7.0 lib/handlebarsjs/handlebars_configuration.rb