Module: AppParser

Defined in:
lib/app_parser.rb,
lib/app_parser/version.rb

Defined Under Namespace

Modules: AppIcon Classes: Apk, Ipa, NotAppError, NotFoundError

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.detect_os(file_name) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/app_parser.rb', line 22

def self.detect_os(file_name)
  case File.extname(file_name.to_s).downcase
  when ".ipa"
    "ios"
  when ".apk"
    "android"
  end
end

.parse(file_name) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/app_parser.rb', line 9

def self.parse(file_name)
  fail NotFoundError, file_name unless File.exist?(file_name)

  case detect_os(file_name)
  when "ios"
    AppParser::Ipa.new(file_name)
  when "android"
    AppParser::Apk.new(file_name)
  else
    fail NotAppError, file_name
  end
end