Class: XcodeMove::GroupMembership
- Inherits:
-
Object
- Object
- XcodeMove::GroupMembership
- Defined in:
- lib/xcmv/group_membership.rb
Instance Attribute Summary collapse
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
-
#inferred_targets ⇒ Object
Returns an array of targets that the ‘group` should reasonably belong to – either based on `sibling_targets` or the `sibling_targets` of some ancestor group.
-
#initialize(group) ⇒ GroupMembership
constructor
A new instance of GroupMembership.
- #max_header_visibility(target) ⇒ Object
Constructor Details
#initialize(group) ⇒ GroupMembership
Returns a new instance of GroupMembership.
13 14 15 16 17 |
# File 'lib/xcmv/group_membership.rb', line 13 def initialize(group) @group = group @project = group.project @siblings = @group.children.to_set end |
Instance Attribute Details
#group ⇒ Object (readonly)
Returns the value of attribute group.
12 13 14 |
# File 'lib/xcmv/group_membership.rb', line 12 def group @group end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
12 13 14 |
# File 'lib/xcmv/group_membership.rb', line 12 def project @project end |
Instance Method Details
#inferred_targets ⇒ Object
Returns an array of targets that the ‘group` should reasonably belong to – either based on `sibling_targets` or the `sibling_targets` of some ancestor group.
22 23 24 25 26 27 28 29 30 |
# File 'lib/xcmv/group_membership.rb', line 22 def inferred_targets target_group = self.group targets = [] while targets.empty? and target_group.respond_to?(:sibling_targets) do targets += target_group.sibling_targets target_group = target_group.parent end targets end |
#max_header_visibility(target) ⇒ Object
32 33 34 35 |
# File 'lib/xcmv/group_membership.rb', line 32 def max_header_visibility(target) sibling_headers = target.headers_build_phase.files.filter{ |f| @siblings.include?(file_ref) } sibling_headers.map{ |f| HeaderVisibility.from_file_settings(f.settings) }.max end |