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.
64 65 66 67 68 |
# File 'lib/i18n-js/export_files_plugin.rb', line 64 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.
62 63 64 |
# File 'lib/i18n-js/export_files_plugin.rb', line 62 def file @file end |
#template ⇒ Object
Returns the value of attribute template.
62 63 64 |
# File 'lib/i18n-js/export_files_plugin.rb', line 62 def template @template end |
#translations ⇒ Object
Returns the value of attribute translations.
62 63 64 |
# File 'lib/i18n-js/export_files_plugin.rb', line 62 def translations @translations end |
Instance Method Details
#banner(comment: "// ", include_time: true) ⇒ Object
70 71 72 73 74 75 |
# File 'lib/i18n-js/export_files_plugin.rb', line 70 def (comment: "// ", include_time: true) [ "#{comment}File generated by i18n-js", include_time ? " on #{Time.now}" : nil ].compact.join end |
#render ⇒ Object
77 78 79 |
# File 'lib/i18n-js/export_files_plugin.rb', line 77 def render ERB.new(File.read(template)).result(binding) end |