Class: AppInfo::Framework

Inherits:
Object show all
Extended by:
Forwardable
Defined in:
lib/app_info/ipa/framework.rb

Overview

iOS Framework parser

Direct Known Subclasses

Plugin

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Framework

Returns a new instance of Framework.



24
25
26
# File 'lib/app_info/ipa/framework.rb', line 24

def initialize(file)
  @file = file
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



19
20
21
# File 'lib/app_info/ipa/framework.rb', line 19

def file
  @file
end

Class Method Details

.parse(path, name = 'Frameworks') ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/app_info/ipa/framework.rb', line 10

def self.parse(path, name = 'Frameworks')
  files = Dir.glob(File.join(path, name.to_s, '*'))
  return [] if files.empty?

  files.sort.each_with_object([]) do |file, obj|
    obj << new(file)
  end
end

Instance Method Details

#infoObject



43
44
45
# File 'lib/app_info/ipa/framework.rb', line 43

def info
  @info ||= InfoPlist.new(File.join(file, 'Info.plist'))
end

#lib?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/app_info/ipa/framework.rb', line 39

def lib?
  File.file?(file)
end

#machoObject



32
33
34
35
36
37
# File 'lib/app_info/ipa/framework.rb', line 32

def macho
  return unless lib?

  require 'macho'
  MachO.open(file)
end

#nameObject



28
29
30
# File 'lib/app_info/ipa/framework.rb', line 28

def name
  File.basename(file)
end

#to_sObject



47
48
49
# File 'lib/app_info/ipa/framework.rb', line 47

def to_s
  "<#{self.class}:#{object_id} @name=#{name}>"
end