Class: CarthageCacheRes::CartfileResolvedFile

Inherits:
Object
  • Object
show all
Defined in:
lib/carthage_cache_res/carthage_resolved_file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path, terminal, swift_version_resolver = SwiftVersionResolver.new) ⇒ CartfileResolvedFile

Returns a new instance of CartfileResolvedFile.



11
12
13
14
15
# File 'lib/carthage_cache_res/carthage_resolved_file.rb', line 11

def initialize(file_path, terminal, swift_version_resolver = SwiftVersionResolver.new)
  @file_path = file_path
  @swift_version_resolver = swift_version_resolver
  @terminal = terminal
end

Instance Attribute Details

#file_pathObject (readonly)

Returns the value of attribute file_path.



7
8
9
# File 'lib/carthage_cache_res/carthage_resolved_file.rb', line 7

def file_path
  @file_path
end

#swift_version_resolverObject (readonly)

Returns the value of attribute swift_version_resolver.



9
10
11
# File 'lib/carthage_cache_res/carthage_resolved_file.rb', line 9

def swift_version_resolver
  @swift_version_resolver
end

#terminalObject (readonly)

Returns the value of attribute terminal.



8
9
10
# File 'lib/carthage_cache_res/carthage_resolved_file.rb', line 8

def terminal
  @terminal
end

Instance Method Details

#contentObject



21
22
23
# File 'lib/carthage_cache_res/carthage_resolved_file.rb', line 21

def content
  @content ||= File.read(file_path)
end

#digestObject



17
18
19
# File 'lib/carthage_cache_res/carthage_resolved_file.rb', line 17

def digest
  @digest ||= generate_digest
end

#frameworksObject



29
30
31
# File 'lib/carthage_cache_res/carthage_resolved_file.rb', line 29

def frameworks
  @frameworks ||= content.each_line.map { |line| extract_framework_name(line) }
end

#swift_versionObject



25
26
27
# File 'lib/carthage_cache_res/carthage_resolved_file.rb', line 25

def swift_version
  @swift_version ||= swift_version_resolver.swift_version
end