Sha256: 0496e82b60c411ba7915204445be801b4f2fd76d761e156b2fdab039876088c6

Contents?: true

Size: 789 Bytes

Versions: 4

Compression:

Stored size: 789 Bytes

Contents

# frozen_string_literal: true

module Handlebarsjs
  # Register this configuration access extension for Handlebars configuration
  module HandlebarsConfigurationExtension
    def handlebars
      return @handlebars if defined? @handlebars

      @handlebars = HandlebarsConfiguration.new
    end
  end

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

    attr_accessor :helpers

    def initialize
      @helpers = []
    end

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

    def helper(name, helper)
      @helpers << HelperConfig.new(name, helper)
    end
  end
end

KConfig::Configuration.register(:handlebars, Handlebarsjs::HandlebarsConfigurationExtension)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
handlebarsjs-0.6.0 lib/handlebarsjs/configuration.rb
handlebarsjs-0.5.7 lib/handlebarsjs/configuration.rb
handlebarsjs-0.5.6 lib/handlebarsjs/configuration.rb
handlebarsjs-0.5.5 lib/handlebarsjs/configuration.rb