Class: Pod::Installer::Analyzer::PodVariant

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods/installer/analyzer/pod_variant.rb

Overview

Bundles the information needed to setup a PodTarget.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(specs, test_specs, app_specs, platform, build_type = Target::BuildType.static_library) ⇒ PodVariant

Initialize a new instance from its attributes.

Parameters:

  • specs (Array<Specification>)

    @see #specs

  • test_specs (Array<Specification>)

    @see #test_specs

  • app_specs (Array<Specification>)

    @see #app_specs

  • platform (Platform)

    @see #platform

  • build_type (Target::BuildType) (defaults to: Target::BuildType.static_library)

    @see #build_type


40
41
42
43
44
45
46
47
# File 'lib/cocoapods/installer/analyzer/pod_variant.rb', line 40

def initialize(specs, test_specs, app_specs, platform, build_type = Target::BuildType.static_library)
  @specs = specs
  @test_specs = test_specs
  @app_specs = app_specs
  @platform = platform
  @build_type = build_type
  @hash = [specs, platform, build_type].hash
end

Instance Attribute Details

#app_specsArray<Specification> (readonly)

Returns the app specs for the target

Returns:


16
17
18
# File 'lib/cocoapods/installer/analyzer/pod_variant.rb', line 16

def app_specs
  @app_specs
end

#build_typeTarget::BuildType (readonly)

Returns the build type of the target

Returns:


24
25
26
# File 'lib/cocoapods/installer/analyzer/pod_variant.rb', line 24

def build_type
  @build_type
end

#platformPlatform (readonly)

Returns the platform

Returns:

  • (Platform)

    the platform


20
21
22
# File 'lib/cocoapods/installer/analyzer/pod_variant.rb', line 20

def platform
  @platform
end

#specsArray<Specification> (readonly)

Returns the spec and subspecs for the target

Returns:

  • (Array<Specification>)

    the spec and subspecs for the target


8
9
10
# File 'lib/cocoapods/installer/analyzer/pod_variant.rb', line 8

def specs
  @specs
end

#test_specsArray<Specification> (readonly)

Returns the test specs for the target

Returns:


12
13
14
# File 'lib/cocoapods/installer/analyzer/pod_variant.rb', line 12

def test_specs
  @test_specs
end

Instance Method Details

#==(other) ⇒ Bool Also known as: eql?

Note:

Test specs are intentionally not included as part of the equality for pod variants since a pod variant should not be affected by the number of test nor app specs included.

Returns whether the Pod::Installer::Analyzer::PodVariant is equal to another taking all all their attributes into account

Returns:


55
56
57
58
59
60
# File 'lib/cocoapods/installer/analyzer/pod_variant.rb', line 55

def ==(other)
  self.class == other.class &&
  build_type == other.build_type &&
    platform == other.platform &&
    specs == other.specs
end

#root_specSpecification

Returns the root specification

Returns:


28
29
30
# File 'lib/cocoapods/installer/analyzer/pod_variant.rb', line 28

def root_spec
  specs.first.root
end