Class: Interaktor::Attributes

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Attributes, ActiveModel::Serialization, ActiveModel::Validations
Defined in:
lib/interaktor/attributes.rb

Constant Summary collapse

DISALLOWED_ATTRIBUTE_NAMES =
instance_methods
.map { |m| m.to_s.freeze }
.freeze

Class Method Summary collapse

Class Method Details

.check_for_disallowed_attribute_names!Object



13
14
15
16
17
18
# File 'lib/interaktor/attributes.rb', line 13

def self.check_for_disallowed_attribute_names!
  attribute_names
    .select { |name| DISALLOWED_ATTRIBUTE_NAMES.include?(name) }
    .join(", ")
    .tap { |names| raise ArgumentError, "Disallowed attribute name(s): #{names}" if names.present? }
end