Class: XcodeMove::HeaderVisibility

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/xcmv/header_visibility.rb

Constant Summary collapse

PRIVATE =
HeaderVisibility.new(1)
PROJECT =
HeaderVisibility.new(2)
PUBLIC =
HeaderVisibility.new(3)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



17
18
19
# File 'lib/xcmv/header_visibility.rb', line 17

def value
  @value
end

Class Method Details

.default_for_target(native_target) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/xcmv/header_visibility.rb', line 19

def self.default_for_target(native_target)
  case native_target.product_type
  when "com.apple.product-type.framework"
    PUBLIC
  else
    PROJECT
  end
end

.from_file_settings(settings) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/xcmv/header_visibility.rb', line 28

def self.from_file_settings(settings)
  case settings["ATTRIBUTES"]
  when "Public"
    PUBLIC
  when "Private"
    PRIVATE
  when nil
    PROJECT
  end
end

Instance Method Details

#<=>(other) ⇒ Object



51
52
53
# File 'lib/xcmv/header_visibility.rb', line 51

def <=>(other)
  value <=> other.value
end

#file_settingsObject



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/xcmv/header_visibility.rb', line 39

def file_settings
  case self
  when PUBLIC
    visibility = "Public"
  when PRIVATE
    visibility = "Private"
  when PROJECT
    visibility = nil
  end
  { "ATTRIBUTES": [visibility] }
end