class POEditor::Configuration
Attributes
api_key[RW]
@return [String] POEditor
API key @see poeditor.com/account/api POEditor
API Access
filters[RW]
@return [Array<String>] Filters by 'translated', 'untranslated', 'fuzzy', 'not_fuzzy', 'automatic', 'not_automatic', 'proofread', 'not_proofread' (optional)
language_alias[RW]
@return [Hash{Sting => String}] The languages aliases
languages[RW]
@return [Array<String>] The languages codes
path[RW]
@return [String] The path template
path_copy[RW]
@return [Hash{Sting => String}] The path copies
path_replace[RW]
@return [Hash{Sting => String}] The path replacements
project_id[RW]
@return [String] POEditor
project ID
type[RW]
@return [String] Export file type (po, apple_strings, android_strings)
Public Class Methods
new(api_key:, project_id:, type:, tags:nil, filters:nil, languages:, language_alias:nil, path:, path_replace:nil, path_copy:nil)
click to toggle source
# File lib/Configuration.rb, line 34 def initialize(api_key:, project_id:, type:, tags:nil, filters:nil, languages:, language_alias:nil, path:, path_replace:nil, path_copy:nil) @api_key = from_env(api_key) @project_id = from_env(project_id.to_s) @type = type @tags = tags || [] @filters = filters || [] @languages = languages @language_alias = language_alias || {} @path = path @path_replace = path_replace || {} @path_copy = path_copy || {} if @path_replace.any? and @path_copy.any? @path_replace.each { |language_key, v| if @path_copy.key?(language_key) raise POEditor::Exception.new "'path_replace' and 'path_copy' are different strategies of one functionality and thus cannot be in use simultaneously for same language." end } end end
Public Instance Methods
from_env(value)
click to toggle source
# File lib/Configuration.rb, line 58 def from_env(value) if value.start_with?("$") key = value[1..-1] ENV[key] else value end end