Class: Steep::Server::TargetGroupFiles

Inherits:
Object
  • Object
show all
Defined in:
lib/steep/server/target_group_files.rb

Defined Under Namespace

Classes: PathEnumerator

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project) ⇒ TargetGroupFiles

Returns a new instance of TargetGroupFiles.



130
131
132
133
134
135
136
# File 'lib/steep/server/target_group_files.rb', line 130

def initialize(project)
  @project = project
  @source_paths = PathEnumerator.new
  @signature_paths = PathEnumerator.new
  @inline_paths = PathEnumerator.new
  @library_paths = {}
end

Instance Attribute Details

#inline_pathsObject (readonly)

Returns the value of attribute inline_paths.



126
127
128
# File 'lib/steep/server/target_group_files.rb', line 126

def inline_paths
  @inline_paths
end

#library_pathsObject (readonly)

Returns the value of attribute library_paths.



128
129
130
# File 'lib/steep/server/target_group_files.rb', line 128

def library_paths
  @library_paths
end

#projectObject (readonly)

Returns the value of attribute project.



124
125
126
# File 'lib/steep/server/target_group_files.rb', line 124

def project
  @project
end

#signature_pathsObject (readonly)

Returns the value of attribute signature_paths.



126
127
128
# File 'lib/steep/server/target_group_files.rb', line 126

def signature_paths
  @signature_paths
end

#source_pathsObject (readonly)

Returns the value of attribute source_paths.



126
127
128
# File 'lib/steep/server/target_group_files.rb', line 126

def source_paths
  @source_paths
end

Instance Method Details

#add_library_path(target, *paths) ⇒ Object



161
162
163
# File 'lib/steep/server/target_group_files.rb', line 161

def add_library_path(target, *paths)
  (library_paths[target.name] ||= Set[]).merge(paths)
end

#add_path(path) ⇒ Object



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/steep/server/target_group_files.rb', line 138

def add_path(path)
  if target_group = project.group_for_signature_path(path)
    signature_paths[path] = target_group
    return true
  end
  if target_group = project.group_for_inline_source_path(path)
    inline_paths[path] = target_group
    return true
  end
  if target_group = project.group_for_source_path(path)
    source_paths[path] = target_group
    return true
  end

  false
end

#each_library_path(target, &block) ⇒ Object



165
166
167
168
169
170
171
# File 'lib/steep/server/target_group_files.rb', line 165

def each_library_path(target, &block)
  if block
    library_paths.fetch(target.name).each(&block)
  else
    enum_for(_ = __method__, target)
  end
end

#library_path?(path) ⇒ Boolean

Returns:

  • (Boolean)


173
174
175
# File 'lib/steep/server/target_group_files.rb', line 173

def library_path?(path)
  library_paths.each_value.any? { _1.include?(path) }
end

#registered_path?(path) ⇒ Boolean

Returns:

  • (Boolean)


155
156
157
158
159
# File 'lib/steep/server/target_group_files.rb', line 155

def registered_path?(path)
  source_paths.registered_path?(path) ||
    signature_paths.registered_path?(path) ||
    inline_paths.registered_path?(path)
end