Class: Pod::Installer::Analyzer::SpecsState
- Inherits:
-
Object
- Object
- Pod::Installer::Analyzer::SpecsState
- Defined in:
- lib/cocoapods/installer/analyzer/specs_state.rb
Overview
The names of the pods stored by this class are always the root name of the specification.
The motivation for this class is to ensure that the names of the subspecs are added instead of the name of the Pods.
This class represents the state of a collection of Pods.
Instance Attribute Summary collapse
-
#added ⇒ Set<String>
readonly
The names of the pods that were added.
-
#changed ⇒ Set<String>
readonly
The names of the pods that were changed.
-
#deleted ⇒ Set<String>
readonly
The names of the pods that were deleted.
-
#unchanged ⇒ Set<String>
readonly
The names of the pods that were unchanged.
Instance Method Summary collapse
-
#add_name(name, state) ⇒ void
Adds the name of a Pod to the give state.
-
#initialize(pods_by_state = nil) ⇒ SpecsState
constructor
Initialize a new instance.
-
#print ⇒ void
Displays the state of each pod.
- #to_s(states: %i(added deleted changed unchanged))) ⇒ Object
Constructor Details
#initialize(pods_by_state = nil) ⇒ SpecsState
Initialize a new instance
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/cocoapods/installer/analyzer/specs_state.rb', line 37 def initialize(pods_by_state = nil) @added = Set.new @deleted = Set.new @changed = Set.new @unchanged = Set.new if pods_by_state { :added => :added, :changed => :changed, :removed => :deleted, :unchanged => :unchanged, }.each do |state, spec_state| Array(pods_by_state[state]).each do |name| add_name(name, spec_state) end end end end |
Instance Attribute Details
#added ⇒ Set<String> (readonly)
Returns the names of the pods that were added.
17 18 19 |
# File 'lib/cocoapods/installer/analyzer/specs_state.rb', line 17 def added @added end |
#changed ⇒ Set<String> (readonly)
Returns the names of the pods that were changed.
21 22 23 |
# File 'lib/cocoapods/installer/analyzer/specs_state.rb', line 21 def changed @changed end |
#deleted ⇒ Set<String> (readonly)
Returns the names of the pods that were deleted.
25 26 27 |
# File 'lib/cocoapods/installer/analyzer/specs_state.rb', line 25 def deleted @deleted end |
#unchanged ⇒ Set<String> (readonly)
Returns the names of the pods that were unchanged.
29 30 31 |
# File 'lib/cocoapods/installer/analyzer/specs_state.rb', line 29 def unchanged @unchanged end |
Instance Method Details
#add_name(name, state) ⇒ void
This method returns an undefined value.
Adds the name of a Pod to the give state.
82 83 84 |
# File 'lib/cocoapods/installer/analyzer/specs_state.rb', line 82 def add_name(name, state) send(state) << Specification.root_name(name) end |
#print ⇒ void
This method returns an undefined value.
Displays the state of each pod.
61 62 63 64 65 66 |
# File 'lib/cocoapods/installer/analyzer/specs_state.rb', line 61 def print states = %i(added deleted changed unchanged) lines(states).each do |line| UI.(line, '', 2) end end |
#to_s(states: %i(added deleted changed unchanged))) ⇒ Object
68 69 70 |
# File 'lib/cocoapods/installer/analyzer/specs_state.rb', line 68 def to_s(states: %i(added deleted changed unchanged)) lines(states).join("\n") end |