Sha256: 3bbfba35b3a049dab1f426d0e9ed82de4f4eb62e2af264f8a1432006d80b57f6

Contents?: true

Size: 825 Bytes

Versions: 1

Compression:

Stored size: 825 Bytes

Contents

# encoding: utf-8
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

1 entries across 1 versions & 1 rubygems

Version Path
rails_best_practices-1.19.1 lib/rails_best_practices/core/klasses.rb