Class: FFIDB::Library
- Inherits:
-
Object
- Object
- FFIDB::Library
- Includes:
- Comparable, SymbolTable
- Defined in:
- lib/ffidb/library.rb
Instance Attribute Summary collapse
-
#dlopen ⇒ Object
readonly
Returns the value of attribute dlopen.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#objects ⇒ Object
readonly
Returns the value of attribute objects.
-
#packages ⇒ Object
readonly
Returns the value of attribute packages.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#summary ⇒ Object
readonly
Returns the value of attribute summary.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
-
#website ⇒ Object
readonly
Returns the value of attribute website.
Instance Method Summary collapse
- #<=>(other) ⇒ Integer
- #each_enum {|enum| ... } ⇒ Enumerator
- #each_function {|function| ... } ⇒ Enumerator
- #each_release {|release| ... } ⇒ Enumerator
- #each_struct {|struct| ... } ⇒ Enumerator
- #each_symbol {|symbol| ... } ⇒ Enumerator
- #each_typedef {|typedef| ... } ⇒ Enumerator
- #each_union {|union| ... } ⇒ Enumerator
-
#initialize(name, version, path) ⇒ Library
constructor
A new instance of Library.
- #soname ⇒ String
Methods included from SymbolTable
Constructor Details
#initialize(name, version, path) ⇒ Library
Returns a new instance of Library.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/ffidb/library.rb', line 36 def initialize(name, version, path) @name, @version = name.to_s.freeze, (version || :stable).to_s.freeze @path = Pathname(path).freeze if ( = @path.join('library.yaml')).exist? = YAML.load(.read).transform_keys(&:to_sym) .delete(:name) @summary = .delete(:summary).freeze @website = .delete(:website).freeze @source = .delete(:source).freeze @packages = .delete(:packages).transform_keys(&:to_sym).freeze dlopen = .delete(:dlopen).freeze @dlopen = dlopen.is_a?(Array) ? dlopen : [dlopen] @objects = (.delete(:objects) || []).freeze @headers = (.delete(:headers) || []).freeze end end |
Instance Attribute Details
#dlopen ⇒ Object (readonly)
Returns the value of attribute dlopen.
23 24 25 |
# File 'lib/ffidb/library.rb', line 23 def dlopen @dlopen end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
25 26 27 |
# File 'lib/ffidb/library.rb', line 25 def headers @headers end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
15 16 17 |
# File 'lib/ffidb/library.rb', line 15 def name @name end |
#objects ⇒ Object (readonly)
Returns the value of attribute objects.
24 25 26 |
# File 'lib/ffidb/library.rb', line 24 def objects @objects end |
#packages ⇒ Object (readonly)
Returns the value of attribute packages.
22 23 24 |
# File 'lib/ffidb/library.rb', line 22 def packages @packages end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
17 18 19 |
# File 'lib/ffidb/library.rb', line 17 def path @path end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
21 22 23 |
# File 'lib/ffidb/library.rb', line 21 def source @source end |
#summary ⇒ Object (readonly)
Returns the value of attribute summary.
19 20 21 |
# File 'lib/ffidb/library.rb', line 19 def summary @summary end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
16 17 18 |
# File 'lib/ffidb/library.rb', line 16 def version @version end |
#website ⇒ Object (readonly)
Returns the value of attribute website.
20 21 22 |
# File 'lib/ffidb/library.rb', line 20 def website @website end |
Instance Method Details
#<=>(other) ⇒ Integer
30 |
# File 'lib/ffidb/library.rb', line 30 def <=>(other) self.name <=> other&.name end |
#each_enum {|enum| ... } ⇒ Enumerator
79 80 81 82 |
# File 'lib/ffidb/library.rb', line 79 def each_enum(&block) return self.to_enum(:each_enum) unless block_given? self.each_symbol.filter { |symbol| symbol.enum? }.each(&block) end |
#each_function {|function| ... } ⇒ Enumerator
106 107 108 109 |
# File 'lib/ffidb/library.rb', line 106 def each_function(&block) return self.to_enum(:each_function) unless block_given? self.each_symbol.filter { |symbol| symbol.function? }.each(&block) end |
#each_release {|release| ... } ⇒ Enumerator
61 62 63 64 |
# File 'lib/ffidb/library.rb', line 61 def each_release(&block) return self.to_enum(:each_release) unless block_given? # TODO end |
#each_struct {|struct| ... } ⇒ Enumerator
88 89 90 91 |
# File 'lib/ffidb/library.rb', line 88 def each_struct(&block) return self.to_enum(:each_struct) unless block_given? self.each_symbol.filter { |symbol| symbol.struct? }.each(&block) end |
#each_symbol {|symbol| ... } ⇒ Enumerator
115 116 117 118 |
# File 'lib/ffidb/library.rb', line 115 def each_symbol(&block) return self.to_enum(:each_symbol) unless block_given? LibraryParser.new(self.path.join(self.version)).each_symbol(&block) end |
#each_typedef {|typedef| ... } ⇒ Enumerator
70 71 72 73 |
# File 'lib/ffidb/library.rb', line 70 def each_typedef(&block) return self.to_enum(:each_typedef) unless block_given? self.each_symbol.filter { |symbol| symbol.typedef? }.each(&block) end |
#each_union {|union| ... } ⇒ Enumerator
97 98 99 100 |
# File 'lib/ffidb/library.rb', line 97 def each_union(&block) return self.to_enum(:each_union) unless block_given? self.each_symbol.filter { |symbol| symbol.union? }.each(&block) end |
#soname ⇒ String
55 |
# File 'lib/ffidb/library.rb', line 55 def soname() self.objects&.first end |