Class: RuboCop::Cop::Rails::HashSerializer

Inherits:
Base
  • Object
show all
Defined in:
lib/rubocop/cop/hash_serializer_cops.rb

Overview

This cop checks for the use of the serialize Hash macro.

Examples:

# bad
# serialize :params, Hash

# good
# serialize :params, JSON

Constant Summary collapse

MSG =
'Prefer saving parameters to JSON or manual, if possible.'
RESTRICT_ON_SEND =
%i[serialize].freeze

Instance Method Summary collapse

Instance Method Details

#on_send(node) ⇒ Object



22
23
24
25
26
# File 'lib/rubocop/cop/hash_serializer_cops.rb', line 22

def on_send(node)
  return unless serializable_hash?(node)

  add_offense(node)
end