Class: Translatomatic::ResourceFile::Subtitle
- Defined in:
- lib/translatomatic/resource_file/subtitle.rb
Overview
Subtitle resource file. requires ‘titlekit’ gem
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
-
.enabled? ⇒ boolean
True if this resource format is enabled.
-
.extensions ⇒ Array<String>
File extensions supported by this resource file.
Instance Method Summary collapse
-
#save(target = path, options = {}) ⇒ void
Save the resource file.
-
#set(key, value) ⇒ String
Set a property.
Methods inherited from Base
#create_variable, #format, #get, #initialize, is_key_value?, #locale_path, #sentences, supports_variable_interpolation?, #to_s, #type, #variable_regex
Constructor Details
This class inherits a constructor from Translatomatic::ResourceFile::Base
Class Method Details
.enabled? ⇒ boolean
12 13 14 15 16 17 18 19 |
# File 'lib/translatomatic/resource_file/subtitle.rb', line 12 def self.enabled? @enabled ||= begin require 'titlekit' true rescue LoadError false end end |
.extensions ⇒ Array<String>
7 8 9 |
# File 'lib/translatomatic/resource_file/subtitle.rb', line 7 def self.extensions %w{srt ass ssa} end |
Instance Method Details
#save(target = path, options = {}) ⇒ void
This method returns an undefined value.
Save the resource file.
30 31 32 |
# File 'lib/translatomatic/resource_file/subtitle.rb', line 30 def save(target = path, = {}) export(target) end |
#set(key, value) ⇒ String
Set a property
22 23 24 25 26 27 |
# File 'lib/translatomatic/resource_file/subtitle.rb', line 22 def set(key, value) super(key, value) if @subtitle_map.include?(key) @subtitle_map[key][:lines] = value end end |