Class: Handlebarsjs::HandlebarsConfigurationDefaults

Inherits:
Object
  • Object
show all
Defined in:
lib/handlebarsjs/handlebars_configuration_defaults.rb

Overview

Pre-configure default helpers for each category

Instance Method Summary collapse

Instance Method Details

#add_all_defaultsObject



6
7
8
9
10
11
12
13
# File 'lib/handlebarsjs/handlebars_configuration_defaults.rb', line 6

def add_all_defaults
  add_array_defaults
  add_case_defaults
  add_comparison_defaults
  add_inflection_defaults
  add_misc_defaults
  add_str_defaults
end

#add_array_defaultsObject



15
16
17
18
19
20
21
# File 'lib/handlebarsjs/handlebars_configuration_defaults.rb', line 15

def add_array_defaults
  KConfig.configure do |config|
    config.handlebars.helper(:join, Handlebarsjs::Helpers::Array::Join.new)
    config.handlebars.helper(:join_post, Handlebarsjs::Helpers::Array::JoinPost.new)
    config.handlebars.helper(:join_pre, Handlebarsjs::Helpers::Array::JoinPre.new)
  end
end

#add_case_defaultsObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/handlebarsjs/handlebars_configuration_defaults.rb', line 23

def add_case_defaults
  KConfig.configure do |config|
    config.handlebars.helper(:back_slash, Handlebarsjs::Helpers::Case::BackSlash.new, aliases: %i[backward_slash slash_backward])
    config.handlebars.helper(:camel, Handlebarsjs::Helpers::Case::Camel.new, aliases: %i[camel_upper camelUpper camelU pascalcase])
    config.handlebars.helper(:constant, Handlebarsjs::Helpers::Case::Constant.new, aliases: %i[constantize])
    config.handlebars.helper(:dash, Handlebarsjs::Helpers::Case::Dash.new, aliases: %i[dasherize dashify dashcase hyphenate])
    config.handlebars.helper(:dot, Handlebarsjs::Helpers::Case::Dot.new, aliases: %i[dotirize dotify dotcase hyphenate])
    config.handlebars.helper(:double_colon, Handlebarsjs::Helpers::Case::DoubleColon.new)
    config.handlebars.helper(:human, Handlebarsjs::Helpers::Case::Human.new, aliases: %i[humanize sentence])
    config.handlebars.helper(:lamel, Handlebarsjs::Helpers::Case::Lamel.new, aliases: %i[camel_lower camelLower camelL])
    config.handlebars.helper(:lower, Handlebarsjs::Helpers::Case::Lower.new, aliases: %i[lowercase downcase])
    config.handlebars.helper(:slash, Handlebarsjs::Helpers::Case::Slash.new, aliases: %i[forward_slash slash_forward])
    config.handlebars.helper(:snake, Handlebarsjs::Helpers::Case::Snake.new)
    config.handlebars.helper(:title, Handlebarsjs::Helpers::Case::Title.new, aliases: %i[titleize])
    config.handlebars.helper(:upper, Handlebarsjs::Helpers::Case::Upper.new, aliases: %i[upcase uppercase])
  end
end

#add_comparison_defaultsObject



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/handlebarsjs/handlebars_configuration_defaults.rb', line 41

def add_comparison_defaults
  KConfig.configure do |config|
    config.handlebars.helper(:and, Handlebarsjs::Helpers::Comparison::And.new)
    config.handlebars.helper(:default, Handlebarsjs::Helpers::Comparison::Default.new)
    config.handlebars.helper(:eq, Handlebarsjs::Helpers::Comparison::Eq.new)
    config.handlebars.helper(:gt, Handlebarsjs::Helpers::Comparison::Gt.new)
    config.handlebars.helper(:gte, Handlebarsjs::Helpers::Comparison::Gte.new)
    config.handlebars.helper(:lt, Handlebarsjs::Helpers::Comparison::Lt.new)
    config.handlebars.helper(:lte, Handlebarsjs::Helpers::Comparison::Lte.new)
    config.handlebars.helper(:ne, Handlebarsjs::Helpers::Comparison::Ne.new)
    config.handlebars.helper(:or, Handlebarsjs::Helpers::Comparison::Or.new)
  end
end

#add_inflection_defaultsObject



55
56
57
58
59
60
61
62
63
64
# File 'lib/handlebarsjs/handlebars_configuration_defaults.rb', line 55

def add_inflection_defaults
  KConfig.configure do |config|
    config.handlebars.helper(:ordinal, Handlebarsjs::Helpers::Inflection::Ordinal.new)
    config.handlebars.helper(:ordinalize, Handlebarsjs::Helpers::Inflection::Ordinalize.new)
    config.handlebars.helper(:pluralize, Handlebarsjs::Helpers::Inflection::Pluralize.new)
    config.handlebars.helper(:pluralize_number, Handlebarsjs::Helpers::Inflection::PluralizeNumber.new)
    config.handlebars.helper(:pluralize_number_word, Handlebarsjs::Helpers::Inflection::PluralizeNumberWord.new)
    config.handlebars.helper(:singularize, Handlebarsjs::Helpers::Inflection::Singularize.new)
  end
end

#add_misc_defaultsObject



66
67
68
69
70
71
# File 'lib/handlebarsjs/handlebars_configuration_defaults.rb', line 66

def add_misc_defaults
  KConfig.configure do |config|
    config.handlebars.helper(:format_json, Handlebarsjs::Helpers::Misc::FormatJson.new)
    config.handlebars.helper(:safe, Handlebarsjs::Helpers::Misc::Safe.new)
  end
end

#add_str_defaultsObject



73
74
75
76
77
78
# File 'lib/handlebarsjs/handlebars_configuration_defaults.rb', line 73

def add_str_defaults
  KConfig.configure do |config|
    config.handlebars.helper(:padl, Handlebarsjs::Helpers::Str::Padl.new)
    config.handlebars.helper(:padr, Handlebarsjs::Helpers::Str::Padr.new)
  end
end