Sha256: 26d97ab7d99c9a6635bf573da2897c37a627af7c23ea3794c70f620cb4a73c5f

Contents?: true

Size: 547 Bytes

Versions: 30

Compression:

Stored size: 547 Bytes

Contents

class File
  def self.lproj_part(filename)
    filename.split('/').each do |part|
      return part if part =~ /^.*\.lproj$/
    end
    nil
  end
  
  def self.omit_lproj(filename)
    File.join(filename.split('/').delete_if { |p| p.match(/^.*\.lproj$/) })
  end
  
  def self.localized(filename, language)
    if lproj_part(filename)
      File.join(filename.split('/').map { |p| p.match(/^.*\.lproj$/) ? "#{language}.lproj" : p })
    else
      File.join(File.dirname(filename), "#{language}.lproj", File.basename(filename))
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
babelyoda-2.2.0 lib/babelyoda/file.rb
babelyoda-2.1.20 lib/babelyoda/file.rb
babelyoda-2.1.19 lib/babelyoda/file.rb
babelyoda-2.1.18 lib/babelyoda/file.rb
babelyoda-2.1.17 lib/babelyoda/file.rb
babelyoda-2.1.16 lib/babelyoda/file.rb
babelyoda-2.1.15 lib/babelyoda/file.rb
babelyoda-2.1.14 lib/babelyoda/file.rb
babelyoda-2.1.13 lib/babelyoda/file.rb
babelyoda-2.1.12 lib/babelyoda/file.rb
babelyoda-2.1.11 lib/babelyoda/file.rb
babelyoda-2.1.10 lib/babelyoda/file.rb
babelyoda-2.1.9 lib/babelyoda/file.rb
babelyoda-2.1.8 lib/babelyoda/file.rb
babelyoda-2.1.7 lib/babelyoda/file.rb
babelyoda-2.1.6 lib/babelyoda/file.rb
babelyoda-2.1.5 lib/babelyoda/file.rb
babelyoda-2.1.4 lib/babelyoda/file.rb
babelyoda-2.1.3 lib/babelyoda/file.rb
babelyoda-2.1.2 lib/babelyoda/file.rb