lib/i18n/js.rb in i18n-js-3.0.5 vs lib/i18n/js.rb in i18n-js-3.0.6

- old
+ new

@@ -87,31 +87,32 @@ return Utils.deep_key_sort(translations) if I18n::JS.sort_translation_keys? translations end def self.translation_segments - if config? && config[:translations] + if config_file_exists? && config[:translations] configured_segments else [Segment.new("#{DEFAULT_EXPORT_DIR_PATH}/translations.js", translations)] end end # Load configuration file for partial exporting and # custom output directory def self.config - if config? + if config_file_exists? erb_result_from_yaml_file = ERB.new(File.read(config_file_path)).result Private::HashWithSymbolKeys.new( (::YAML.load(erb_result_from_yaml_file) || {}) ) else Private::HashWithSymbolKeys.new({}) end.freeze end + # @api private # Check if configuration file exist - def self.config? + def self.config_file_exists? File.file? config_file_path end def self.scoped_translations(scopes, exceptions = []) # :nodoc: result = {}