lib/skippy/module_manager.rb in skippy-0.4.3.a vs lib/skippy/module_manager.rb in skippy-0.5.0.a

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + require 'fileutils' require 'json' require 'pathname' require 'set' @@ -21,12 +23,12 @@ @project = project @modules = SortedSet.new(discover_modules) end # @yield [Skippy::LibModule] - def each - @modules.each { |lib_module| yield lib_module } + def each(&block) + @modules.each(&block) self end def empty? to_a.empty? @@ -39,10 +41,10 @@ end # @param [Skippy::LibModule, String] lib_module def installed?(lib_module) module_name = lib_module.name - modules = project && project.config.get(:modules, []) + modules = project&.config&.get(:modules, []) modules.any? { |mod| mod.casecmp(module_name).zero? } end # @param [String] module_name # @return [Skippy::LibModule]