Class: XcodeMove::GroupMembership

Inherits:
Object
  • Object
show all
Defined in:
lib/xcmv/group_membership.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#groupObject (readonly)

Returns the value of attribute group.



12
13
14
# File 'lib/xcmv/group_membership.rb', line 12

def group
  @group
end

#projectObject (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_targetsObject

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