Sha256: 2062aaddd1b8bc8abe5b3928fe0f96a6315c5581a5a44656523809bf2f8cc17a

Contents?: true

Size: 542 Bytes

Versions: 1

Compression:

Stored size: 542 Bytes

Contents

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

1 entries across 1 versions & 1 rubygems

Version Path
rails_best_practices-1.19.1 lib/rails_best_practices/prepares/config_prepare.rb