class Yoda::Store::Objects::ProjectStatus::BundleStatus

Remember gem dependencies and loaded gems

Attributes

gem_statuses[R]

@return [Array<GemStatus>]

std_status[R]

@return [StdStatus]

Public Class Methods

initial_build(specs) click to toggle source

@param specs [Array<Bundler::LazySpecification>] @return [BundleStatus]

# File lib/yoda/store/objects/project_status.rb, line 42
def self.initial_build(specs)
  gem_statuses = specs.map { |spec| ProjectStatus::GemStatus.initial_build(spec) }
  std_status = StdStatus.initial_build
  new(gem_statuses: gem_statuses, std_status: std_status)
end
new(gem_statuses:, std_status:) click to toggle source

@param gem_statuses [Array<GemStatus>] @param std_status [StdStatus]

# File lib/yoda/store/objects/project_status.rb, line 50
def initialize(gem_statuses:, std_status:)
  @gem_statuses = gem_statuses
  @std_status = std_status
end

Public Instance Methods

[](name) click to toggle source

@param name [String] @return [GemStatus, nil]

# File lib/yoda/store/objects/project_status.rb, line 61
def [](name)
  dictionary[name]
end
all_present?() click to toggle source

@return [true, false]

# File lib/yoda/store/objects/project_status.rb, line 66
def all_present?
  gem_statuses.all?(&:present?) && std_status.all_present?
end
not_present_gems() click to toggle source

@return [Array<GemStatus>]

# File lib/yoda/store/objects/project_status.rb, line 76
def not_present_gems
  gem_statuses.reject(&:present?)
end
present_gems() click to toggle source

@return [Array<GemStatus>]

# File lib/yoda/store/objects/project_status.rb, line 71
def present_gems
  gem_statuses.select(&:present?)
end
to_h() click to toggle source
# File lib/yoda/store/objects/project_status.rb, line 55
def to_h
  { gem_statuses: gem_statuses, std_status: std_status }
end

Private Instance Methods

dictionary() click to toggle source

@return [Hash{String => GemStatus}]

# File lib/yoda/store/objects/project_status.rb, line 83
def dictionary
  @dictionary ||= gem_statuses.map do |gem_status|
    [gem_status.name, gem_status]
  end.to_h
end