Sha256: e51c8e22e03acbc6048f01c5122cd667ffb0ecf932005b95ea3a7d452cc5785b

Contents?: true

Size: 585 Bytes

Versions: 7

Compression:

Stored size: 585 Bytes

Contents

# encoding: utf-8
require 'rails_best_practices/core/check'

module RailsBestPractices
  module Prepares
    # Remember all configs
    class ConfigPrepare < Core::Check
      interesting_nodes :assign
      interesting_files CONFIG_FILES

      def initialize
        @configs = Prepares.configs
      end

      # check assignments to config
      add_callback :start_assign do |node|
        if node.left_value.grep_node(sexp_type: [:vcall, :var_ref], to_s: "config").present?
          @configs[node.left_value.to_s] = node.right_value.to_s
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rails_best_practices-1.13.8 lib/rails_best_practices/prepares/config_prepare.rb
rails_best_practices-1.13.5 lib/rails_best_practices/prepares/config_prepare.rb
rails_best_practices-1.13.4 lib/rails_best_practices/prepares/config_prepare.rb
rails_best_practices-1.13.3 lib/rails_best_practices/prepares/config_prepare.rb
rails_best_practices-1.13.2 lib/rails_best_practices/prepares/config_prepare.rb
rails_best_practices-1.13.1 lib/rails_best_practices/prepares/config_prepare.rb
rails_best_practices-1.13.0 lib/rails_best_practices/prepares/config_prepare.rb