Sha256: ce4407ee54e48a84e6e2992621c57d8722eb836fc2a62d06ec12df3e3bd6f7c2

Contents?: true

Size: 837 Bytes

Versions: 12

Compression:

Stored size: 837 Bytes

Contents

# frozen_string_literal: true

module RailsBestPractices
  module Core
    # Klass container.
    class Klasses < Array
      # If include the class.
      #
      # @param [String] class name
      # @return [Boolean] include or not
      def include?(class_name)
        find { |klass| klass.to_s == class_name }
      end
    end

    # Class info includes class name, extend class name and module names.
    class Klass
      attr_reader :extend_class_name, :class_name

      def initialize(class_name, extend_class_name, modules)
        @modules = modules.dup
        base = @modules.map { |modu| "#{modu}::" }.join('')
        @class_name = base + class_name
        if extend_class_name
          @extend_class_name = base + extend_class_name
        end
      end

      def to_s
        class_name
      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/klasses.rb
rails_best_practices-1.23.1 lib/rails_best_practices/core/klasses.rb
rails_best_practices-1.23.0 lib/rails_best_practices/core/klasses.rb
rails_best_practices-1.22.1 lib/rails_best_practices/core/klasses.rb
rails_best_practices-1.22.0 lib/rails_best_practices/core/klasses.rb
rails_best_practices-1.21.0 lib/rails_best_practices/core/klasses.rb
rails_best_practices-1.20.1 lib/rails_best_practices/core/klasses.rb
rails_best_practices-1.20.0 lib/rails_best_practices/core/klasses.rb
rails_best_practices-1.19.5 lib/rails_best_practices/core/klasses.rb
rails_best_practices-1.19.4 lib/rails_best_practices/core/klasses.rb
rails_best_practices-1.19.3 lib/rails_best_practices/core/klasses.rb
rails_best_practices-1.19.2 lib/rails_best_practices/core/klasses.rb