Module: Virtus::Extensions::AllowedWriterMethods

Defined in:
lib/virtus/extensions.rb

Overview

Methods

API:

  • public

Constant Summary collapse

WRITER_METHOD_REGEXP =

API:

  • public

/=\z/.freeze
INVALID_WRITER_METHODS =

API:

  • public

%w[ == != === []= attributes= ].to_set.freeze

Instance Method Summary collapse

Instance Method Details

#allowed_writer_methodsSet

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The list of writer methods that can be mass-assigned to in #attributes=

Returns:

API:

  • private



100
101
102
103
104
105
106
107
# File 'lib/virtus/extensions.rb', line 100

def allowed_writer_methods
  @allowed_writer_methods ||=
    begin
      allowed_writer_methods  = allowed_methods.grep(WRITER_METHOD_REGEXP).to_set
      allowed_writer_methods -= INVALID_WRITER_METHODS
      allowed_writer_methods.freeze
    end
end