module AdLocalize::Serializers::WithTemplate
Constants
- TEMPLATES_DIRECTORY
Public Instance Methods
render(locale_wording:)
click to toggle source
# File lib/ad_localize/serializers/with_template.rb, line 6 def render(locale_wording:) hash_binding = hash_binding(locale_wording: locale_wording) return unless hash_binding render_template(template_path: template_path, hash_binding: hash_binding) end
render_template(template_path:, hash_binding:)
click to toggle source
# File lib/ad_localize/serializers/with_template.rb, line 12 def render_template(template_path:, hash_binding:) template = File.read(template_path) renderer = ERB.new(template, trim_mode: '-') renderer.result_with_hash(hash_binding) end