Sha256: 25877750d9ab16728e95f01af03fd9beb45d012bd8089400aa8119ebe45027a3

Contents?: true

Size: 1015 Bytes

Versions: 28

Compression:

Stored size: 1015 Bytes

Contents

module Symbols
  def symbols_from_library(library)
    syms = `nm -gU #{library}`.split("\n")
    result = classes_from_symbols(syms)
    result += constants_from_symbols(syms)

    result.reject { |e| e == 'llvm.cmdline' || e == 'llvm.embedded.module' }
  end

  module_function :symbols_from_library

  private

  def classes_from_symbols(syms)
    classes = syms.select { |klass| klass[/OBJC_CLASS_\$_/] }
    classes = classes.uniq
    classes.map! { |klass| klass.gsub(/^.*\$_/, '') }
  end

  def constants_from_symbols(syms)
    consts = syms.select { |const| const[/ S /] }
    consts = consts.select { |const| const !~ /OBJC|\.eh/ }
    consts = consts.uniq
    consts = consts.map! { |const| const.gsub(/^.* _/, '') }

    other_consts = syms.select { |const| const[/ T /] }
    other_consts = other_consts.uniq
    other_consts = other_consts.map! { |const| const.gsub(/^.* _/, '') }

    consts + other_consts
  end

  module_function :classes_from_symbols
  module_function :constants_from_symbols
end

Version data entries

28 entries across 28 versions & 8 rubygems

Version Path
cocoapods-packager-tj-1.5.0 lib/cocoapods-packager/symbols.rb
cocoapods-panglePackager-1.5.0.2 lib/cocoapods-panglePackager/symbols.rb
cocoapods-panglePackager-1.5.0.1 lib/cocoapods-panglePackager/symbols.rb
cocoapods-fanQiePackager-1.5.0.1 lib/cocoapods-fanQiePackager/symbols.rb
cocoapods-packager-m-1.6.4 lib/cocoapods-packager/symbols.rb
ty-cocoapods-packager-1.5.2 lib/cocoapods-packager/symbols.rb
ty-cocoapods-packager-1.5.1 lib/cocoapods-packager/symbols.rb
ty-cocoapods-packager-1.5.0 lib/cocoapods-packager/symbols.rb
cocoapods-packager-qcloud-1.5.18 lib/cocoapods-packager/symbols.rb
cocoapods-packager-qcloud-1.5.17 lib/cocoapods-packager/symbols.rb
cocoapods-packager-qcloud-1.5.15 lib/cocoapods-packager/symbols.rb
cocoapods-packager-qcloud-1.5.14 lib/cocoapods-packager/symbols.rb
cocoapods-packager-qcloud-1.5.13 lib/cocoapods-packager/symbols.rb
my-cocoapods-packager-1.5.2 lib/cocoapods-packager/symbols.rb
my-cocoapods-packager-1.5.1 lib/cocoapods-packager/symbols.rb
my-cocoapods-packager-1.5.0 lib/cocoapods-packager/symbols.rb
cocoapods-packager-qcloud-1.5.11 lib/cocoapods-packager/symbols.rb
cocoapods-packager-qcloud-1.5.10 lib/cocoapods-packager/symbols.rb
cocoapods-packager-qcloud-1.5.9 lib/cocoapods-packager/symbols.rb
cocoapods-packager-qcloud-1.5.8 lib/cocoapods-packager/symbols.rb