module LHS::Record::AttributeAssignment
Public Instance Methods
assign_attributes(new_attributes)
click to toggle source
# File lib/lhs/concerns/record/attribute_assignment.rb, line 8 def assign_attributes(new_attributes) if !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 Instance Methods
_assign_attributes(attributes)
click to toggle source
# File lib/lhs/concerns/record/attribute_assignment.rb, line 19 def _assign_attributes(attributes) attributes.each do |key, value| public_send(:"#{key}=", value) end end