Class: XCCache::SPM::Package::Product

Inherits:
BaseObject show all
Includes:
Cacheable
Defined in:
lib/xccache/spm/desc/product.rb

Constant Summary

Constants inherited from BaseObject

BaseObject::ATTRS

Instance Attribute Summary

Attributes inherited from HashRepresentable

#path, #raw

Instance Method Summary collapse

Methods included from Cacheable

#__cacheable_module_name, #cacheable, included

Methods inherited from BaseObject

#cast_to, #display_name, #fetch, #full_name, #inspect, #name, #pkg_desc_of, #pkg_name, #pkg_slug, #src_dir, #to_s

Methods included from Config::Mixin

#config

Methods inherited from JSONRepresentable

#load, #save

Methods inherited from HashRepresentable

#[], #[]=, #initialize, #load, #merge!, #reload, #save

Constructor Details

This class inherits a constructor from XCCache::HashRepresentable

Instance Method Details

#flatten_as_targetsObject



14
15
16
# File 'lib/xccache/spm/desc/product.rb', line 14

def flatten_as_targets
  targets
end

#library?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/xccache/spm/desc/product.rb', line 22

def library?
  type == :library
end

#recursive_targets(platform: nil) ⇒ Object



30
31
32
# File 'lib/xccache/spm/desc/product.rb', line 30

def recursive_targets(platform: nil)
  targets + targets.flat_map { |t| t.recursive_targets(platform: platform) }.uniq
end

#target_namesObject



10
11
12
# File 'lib/xccache/spm/desc/product.rb', line 10

def target_names
  raw["targets"]
end

#targetsObject



18
19
20
# File 'lib/xccache/spm/desc/product.rb', line 18

def targets
  @targets ||= root.targets.select { |t| target_names.include?(t.name) }
end

#typeObject



26
27
28
# File 'lib/xccache/spm/desc/product.rb', line 26

def type
  @type ||= raw["type"].keys.first.to_sym
end