lib/potassium/templates/application/helpers/gem-helpers.rb in potassium-1.3.4 vs lib/potassium/templates/application/helpers/gem-helpers.rb in potassium-1.3.5

- old
+ new

@@ -1,16 +1,8 @@ module GemHelpers - - def gem_exists?(regex) - exists = false - File.open("Gemfile").each_line do |line| - if line =~ regex - exists = true - return - end - end - exists + def gem_exists?(regexp) + File.open("Gemfile").each_line.any? { |line| line =~ regexp } end def gather_gem(name, *attributes) ensure_variable(:gems, {}) current_gem_groups = get(:current_gem_groups) || [:base] @@ -18,10 +10,10 @@ get(:gems)[current_gem_groups] ||= [] get(:gems)[current_gem_groups] << { name: name, attributes: attributes } end def discard_gem(name) - get(:gems).each do |environments, gems| + get(:gems).each do |_environments, gems| gems.delete_if do |gem_entry| gem_entry[:name] == name end end end