Sha256: a9012f4fa94a4e2b0db8a8eda762c59d5d84dd74fe1a21f2a6d8d8d28f5e94e3

Contents?: true

Size: 1.2 KB

Versions: 2

Compression:

Stored size: 1.2 KB

Contents

# encoding: utf-8
require 'rails_best_practices/prepares/model_prepare'
require 'rails_best_practices/prepares/mailer_prepare'
require 'rails_best_practices/prepares/schema_prepare'
require 'rails_best_practices/prepares/controller_prepare'

module RailsBestPractices
  module Prepares
    class <<self
      attr_writer :models, :model_associations, :model_attributes, :mailers

      def klasses
        models + mailers + controllers
      end

      def models
        @models ||= Core::Models.new
      end

      def model_associations
        @model_associations ||= Core::ModelAssociations.new
      end

      def model_attributes
        @model_attributes ||= Core::ModelAttributes.new
      end

      def model_methods
        @model_methods ||= Core::Methods.new
      end

      def mailers
        @mailers ||= Core::Mailers.new
      end

      def controllers
        @controllers ||= Core::Controllers.new
      end

      def controller_methods
        @controller_methods ||= Core::Methods.new
      end

      # Clear all prepare objects.
      def clear
        instance_variables.each do |instance_variable|
          instance_variable_set(instance_variable, nil)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_best_practices-1.3.0 lib/rails_best_practices/prepares.rb
rails_best_practices-1.2.0 lib/rails_best_practices/prepares.rb