Sha256: 4b8daccd7c46e760c95cf5d15345e57d988ea1b499f4f0683f90ccecd888bb5a
Contents?: true
Size: 596 Bytes
Versions: 12
Compression:
Stored size: 596 Bytes
Contents
# frozen_string_literal: true class DHS::Record module AttributeAssignment extend ActiveSupport::Concern def assign_attributes(new_attributes) unless new_attributes.respond_to?(:stringify_keys) raise ArgumentError, "When assigning attributes, you must pass a hash as an argument, #{new_attributes.class} passed." end return if new_attributes.empty? _assign_attributes(new_attributes) end private def _assign_attributes(attributes) attributes.each do |key, value| public_send(:"#{key}=", value) end end end end
Version data entries
12 entries across 12 versions & 1 rubygems