Module: Applocale::Platform

Defined in:
lib/applocale/Util/platform.rb

Constant Summary collapse

IOS =
:ios
ANDROID =
:Android
JSON =
:json

Class Method Summary collapse

Class Method Details

.init(platform) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/applocale/Util/platform.rb', line 8

def self.init(platform)
  if platform.upcase == 'IOS'
    return Platform::IOS
  elsif platform.upcase == 'ANDROID'
    return Platform::ANDROID
  elsif platform.upcase == 'JSON'
    return Platform::JSON
  end
  return nil
end

.is_valid_path(platform, path) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/applocale/Util/platform.rb', line 19

def self.is_valid_path(platform, path)
  newpath = path.to_s.strip
  extn = File.extname  newpath
  if platform == Platform::IOS
    if extn.downcase == '.strings'
      return true
    end
  elsif platform == Platform::ANDROID
    if extn.downcase == '.xml'
      return true
    end
  elsif platform == Platform::JSON
    return extn.downcase == '.json'
  end
  return false
end