Module: Fronde::Config::Helpers
- Defined in:
- lib/fronde/config/helpers.rb
Overview
Various utilitaries methods
Class Method Summary collapse
- .ensure_expanded_paths(config) ⇒ Object
- .extract_lang_from_env(default) ⇒ Object
- .migrate(config) ⇒ Object
- .render_liquid_template(content, data) ⇒ Object
Class Method Details
.ensure_expanded_paths(config) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/fronde/config/helpers.rb', line 25 def self.(config) %w[html gemini].each do |what| key = "#{what}_public_folder" config[key] = File. config[key] end config end |
.extract_lang_from_env(default) ⇒ Object
10 11 12 |
# File 'lib/fronde/config/helpers.rb', line 10 def self.extract_lang_from_env(default) (ENV['LANG'] || default).split('_', 2).first end |
.migrate(config) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fronde/config/helpers.rb', line 14 def self.migrate(config) return config unless config.has_key?('public_folder') warn I18n.t('fronde.error.config.deprecated_public_folder') old_pub_folder = config.delete('public_folder') return config if config.has_key?('html_public_folder') config['html_public_folder'] = old_pub_folder config end |
.render_liquid_template(content, data) ⇒ Object
33 34 35 36 |
# File 'lib/fronde/config/helpers.rb', line 33 def self.render_liquid_template(content, data) template = Liquid::Template.parse(content) template.render(data) end |