lib/xcres/analyzer/resources_analyzer/base_resources_analyzer.rb
def build_section_data file_paths, options={}
        options = {
          use_basename: [],
          path_without_ext: false,
        }.merge options

        # Transform image file paths to keys
        keys_to_paths = {}
        for path in file_paths
          basename = File.basename(path)
          key = key_from_path(options[:use_basename].include?(:key) ? basename : path.to_s)
          transformed_path = options[:use_basename].include?(:path) ? basename : path
          if options[:path_without_ext]
            transformed_path = transformed_path.to_s.sub /#{File.extname(path)}$/, ''
          end
          keys_to_paths[key] = transformed_path.to_s
        end

        keys_to_paths
      end
# Build a keys to paths mapping
#
# @param  [Array<Pathname>] file_paths
#         the file paths, which will be the values of the mapping
#
# @param  [Hash] options
#         valid options are:
#         * [Array<Symbol>] :use_basename
#           can contain :key and :path
#
# @return [Hash{String => Pathname}]
#
Build a keys to paths mapping
Build a keys to paths mapping
def build_section_data file_paths, options={}
        options = {
          use_basename: [],
          path_without_ext: false,
        }.merge options
        keys_to_paths = {}
        for path in file_paths
          basename = File.basename(path)
          key = key_from_path(options[:use_basename].include?(:key) ? basename : path.to_s)
          transformed_path = options[:use_basename].include?(:path) ? basename : path
          if options[:path_without_ext]
            transformed_path = transformed_path.to_s.sub /#{File.extname(path)}$/, ''
          end
          keys_to_paths[key] = transformed_path.to_s
        end
        keys_to_paths
      end
def build_section_data file_paths , options = { } options = { use_basename : [ ] , path_without_ext : false , } . merge options keys_to_paths = { } for path in file_paths basename = File . basename ( path ) key = key_from_path ( options [ :use_basename ] . include? ( :key ) ? basename : path . to_s ) transformed_path = options [ :use_basename ] . include? ( :path ) ? basename : path if options [ :path_without_ext ] transformed_path = transformed_path . to_s . sub / #{ File . extname ( path ) } $ / , '' end keys_to_paths [ key ] = transformed_path . to_s end keys_to_paths end
Build a keys to paths mapping
Build a keys to paths mapping
# Transform image file paths to keys
None
Hash{String => Pathname}
file_paths
options
options valid options are: * [Array] :use_basename can contain :key and :path
options valid options are : * [ Array ] : use_basename can contain : key and : path