Class: Pod::SPM::Metadata
- Inherits:
-
Object
- Object
- Pod::SPM::Metadata
- Defined in:
- lib/cocoapods-spm/metadata.rb
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(raw) ⇒ Metadata
constructor
A new instance of Metadata.
- #macro_impl_name ⇒ Object
- #targets ⇒ Object
- #targets_of_type(type) ⇒ Object
Constructor Details
#initialize(raw) ⇒ Metadata
Returns a new instance of Metadata.
8 9 10 |
# File 'lib/cocoapods-spm/metadata.rb', line 8 def initialize(raw) @raw = raw end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
6 7 8 |
# File 'lib/cocoapods-spm/metadata.rb', line 6 def raw @raw end |
Class Method Details
.for_pod(name) ⇒ Object
20 21 22 |
# File 'lib/cocoapods-spm/metadata.rb', line 20 def self.for_pod(name) from_file(Config.instance.macro_root_dir / name / "metadata.json") end |
.from_file(path) ⇒ Object
16 17 18 |
# File 'lib/cocoapods-spm/metadata.rb', line 16 def self.from_file(path) from_s(File.read(path)) end |
.from_s(str) ⇒ Object
12 13 14 |
# File 'lib/cocoapods-spm/metadata.rb', line 12 def self.from_s(str) new(JSON.parse(str)) end |
Instance Method Details
#macro_impl_name ⇒ Object
32 33 34 |
# File 'lib/cocoapods-spm/metadata.rb', line 32 def macro_impl_name targets_of_type("macro").first&.fetch("name") end |
#targets ⇒ Object
24 25 26 |
# File 'lib/cocoapods-spm/metadata.rb', line 24 def targets raw["targets"] end |
#targets_of_type(type) ⇒ Object
28 29 30 |
# File 'lib/cocoapods-spm/metadata.rb', line 28 def targets_of_type(type) targets.select { |t| t["type"] == type } end |