Class: Handlebarsjs::HandlebarsConfiguration

Inherits:
Object
  • Object
show all
Includes:
KLog::Logging
Defined in:
lib/handlebarsjs/handlebars_configuration.rb

Overview

Configuration data such has helpers for handlebarsjs

Defined Under Namespace

Classes: HelperConfig

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHandlebarsConfiguration

Returns a new instance of HandlebarsConfiguration.



11
12
13
14
# File 'lib/handlebarsjs/handlebars_configuration.rb', line 11

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

Instance Attribute Details

#defaultsObject (readonly)

Returns the value of attribute defaults.



9
10
11
# File 'lib/handlebarsjs/handlebars_configuration.rb', line 9

def defaults
  @defaults
end

#helpersObject

Returns the value of attribute helpers.



8
9
10
# File 'lib/handlebarsjs/handlebars_configuration.rb', line 8

def helpers
  @helpers
end

Instance Method Details

#helper(name, helper, aliases: []) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/handlebarsjs/handlebars_configuration.rb', line 18

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