Class: I18nJS::ExportFilesPlugin::Template
- Inherits:
-
Object
- Object
- I18nJS::ExportFilesPlugin::Template
- Defined in:
- lib/i18n-js/export_files_plugin.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#template ⇒ Object
Returns the value of attribute template.
-
#translations ⇒ Object
Returns the value of attribute translations.
Instance Method Summary collapse
- #banner(comment: "// ", include_time: true) ⇒ Object
-
#initialize(**kwargs) ⇒ Template
constructor
A new instance of Template.
- #render ⇒ Object
Constructor Details
#initialize(**kwargs) ⇒ Template
Returns a new instance of Template.
83 84 85 86 87 |
# File 'lib/i18n-js/export_files_plugin.rb', line 83 def initialize(**kwargs) kwargs.each do |key, value| public_send("#{key}=", value) end end |
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file.
81 82 83 |
# File 'lib/i18n-js/export_files_plugin.rb', line 81 def file @file end |
#template ⇒ Object
Returns the value of attribute template.
81 82 83 |
# File 'lib/i18n-js/export_files_plugin.rb', line 81 def template @template end |
#translations ⇒ Object
Returns the value of attribute translations.
81 82 83 |
# File 'lib/i18n-js/export_files_plugin.rb', line 81 def translations @translations end |
Instance Method Details
#banner(comment: "// ", include_time: true) ⇒ Object
89 90 91 92 93 94 |
# File 'lib/i18n-js/export_files_plugin.rb', line 89 def (comment: "// ", include_time: true) [ "#{comment}File generated by i18n-js", include_time ? " on #{Time.now}" : nil ].compact.join end |
#render ⇒ Object
96 97 98 |
# File 'lib/i18n-js/export_files_plugin.rb', line 96 def render ERB.new(File.read(template)).result(binding) end |