Class: Xcprofiler::DerivedData

Inherits:
Object
  • Object
show all
Defined in:
lib/xcprofiler/derived_data.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ DerivedData

Returns a new instance of DerivedData.



37
38
39
# File 'lib/xcprofiler/derived_data.rb', line 37

def initialize(path)
  @path = path
end

Class Method Details

.all(root = nil) ⇒ Object



6
7
8
9
10
# File 'lib/xcprofiler/derived_data.rb', line 6

def all(root = nil)
  root ||= default_derived_data_root
  pattern = File.join(root, "**", "Logs", "Build", "*.xcactivitylog")
  by_pattern(pattern)
end

.by_product_name(product_name, root = nil) ⇒ Object



12
13
14
15
16
# File 'lib/xcprofiler/derived_data.rb', line 12

def by_product_name(product_name, root = nil)
  root ||= default_derived_data_root
  pattern = File.join(root, "#{product_name}-*", "Logs", "Build", "*.xcactivitylog")
  by_pattern(pattern)
end

Instance Method Details

#executionsObject



49
50
51
52
53
54
55
56
# File 'lib/xcprofiler/derived_data.rb', line 49

def executions
  @executions ||= lines.map { |line|
    if line =~ /^[0-9.]+ms\s+.+?\s+.+$/
      time, file, method_name = line.split(/\t/)
      Execution.new(time, file, method_name)
    end
  }.compact
end

#flag_enabled?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/xcprofiler/derived_data.rb', line 58

def flag_enabled?
  lines.any? { |l| l.include?('-Xfrontend -debug-time-function-bodies') }
end

#updated_atObject



45
46
47
# File 'lib/xcprofiler/derived_data.rb', line 45

def updated_at
  File.mtime(@path)
end

#zero?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/xcprofiler/derived_data.rb', line 41

def zero?
  File.zero?(@path)
end