Sha256: 4abc01ea2253fd48416b0b83d45ef13d5b0608a14c6f35d6fa0614b5690aff21

Contents?: true

Size: 556 Bytes

Versions: 12

Compression:

Stored size: 556 Bytes

Contents

# frozen_string_literal: true

module RailsBestPractices
  module Core
    class Gems < Array
      def has_gem?(gem_name)
        find { |gem| gem.name == gem_name }
      end

      def gem_version(gem_name)
        find { |gem| gem.name == gem_name }.try(:version)
      end
    end

    # Gem info includes gem name and gem version
    class Gem
      attr_reader :name, :version

      def initialize(name, version)
        @name = name
        @version = version
      end

      def to_s
        "#{@name} (#{@version})"
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rails_best_practices-1.23.2 lib/rails_best_practices/core/gems.rb
rails_best_practices-1.23.1 lib/rails_best_practices/core/gems.rb
rails_best_practices-1.23.0 lib/rails_best_practices/core/gems.rb
rails_best_practices-1.22.1 lib/rails_best_practices/core/gems.rb
rails_best_practices-1.22.0 lib/rails_best_practices/core/gems.rb
rails_best_practices-1.21.0 lib/rails_best_practices/core/gems.rb
rails_best_practices-1.20.1 lib/rails_best_practices/core/gems.rb
rails_best_practices-1.20.0 lib/rails_best_practices/core/gems.rb
rails_best_practices-1.19.5 lib/rails_best_practices/core/gems.rb
rails_best_practices-1.19.4 lib/rails_best_practices/core/gems.rb
rails_best_practices-1.19.3 lib/rails_best_practices/core/gems.rb
rails_best_practices-1.19.2 lib/rails_best_practices/core/gems.rb