Class: Pod::Swift::PackageDescriptionBaseObject
- Inherits:
-
Object
- Object
- Pod::Swift::PackageDescriptionBaseObject
show all
- Defined in:
- lib/cocoapods-spm/swift/package/base.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of PackageDescriptionBaseObject.
8
9
10
11
|
# File 'lib/cocoapods-spm/swift/package/base.rb', line 8
def initialize(raw, parent: nil)
@raw = raw
@parent = parent
end
|
Instance Attribute Details
#parent ⇒ Object
Returns the value of attribute parent.
6
7
8
|
# File 'lib/cocoapods-spm/swift/package/base.rb', line 6
def parent
@parent
end
|
#raw ⇒ Object
Returns the value of attribute raw.
6
7
8
|
# File 'lib/cocoapods-spm/swift/package/base.rb', line 6
def raw
@raw
end
|
Class Method Details
.from_file(path) ⇒ Object
29
30
31
|
# File 'lib/cocoapods-spm/swift/package/base.rb', line 29
def self.from_file(path)
from_s(File.read(path))
end
|
.from_s(str) ⇒ Object
25
26
27
|
# File 'lib/cocoapods-spm/swift/package/base.rb', line 25
def self.from_s(str)
new(JSON.parse(str))
end
|
Instance Method Details
#[](key) ⇒ Object
39
40
41
|
# File 'lib/cocoapods-spm/swift/package/base.rb', line 39
def [](key)
raw[key]
end
|
#dup_with_attrs(options = {}) ⇒ Object
47
48
49
50
51
|
# File 'lib/cocoapods-spm/swift/package/base.rb', line 47
def dup_with_attrs(options = {})
copy = dup
options.each { |key, value| copy.instance_variable_set("@#{key}", value) }
copy
end
|
#inspect ⇒ Object
Also known as:
to_s
33
34
35
|
# File 'lib/cocoapods-spm/swift/package/base.rb', line 33
def inspect
"#<#{self.class} #{name}>"
end
|
#name ⇒ Object
43
44
45
|
# File 'lib/cocoapods-spm/swift/package/base.rb', line 43
def name
raw["name"]
end
|
#pkg_name ⇒ Object
21
22
23
|
# File 'lib/cocoapods-spm/swift/package/base.rb', line 21
def pkg_name
root.name
end
|
#root ⇒ Object
13
14
15
16
17
18
19
|
# File 'lib/cocoapods-spm/swift/package/base.rb', line 13
def root
@root ||= begin
node = self
node = node.parent until node.parent.nil?
node
end
end
|