Skip to content

Commit

Permalink
Do not modify the value if it is the same.
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Sep 26, 2018
1 parent ecad7e8 commit ec3021f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions library/network/src/lib/y2firewall/firewalld/relations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def has_attributes(*attributes, scope: nil, cache: false) # rubocop:disable Styl
attr_reader attribute

define_method "#{attribute}=" do |item|
return item if public_send(attribute) == item
instance_variable_set("@#{attribute}", item)

modified!(attribute) if cache
Expand Down Expand Up @@ -183,6 +184,7 @@ def has_many(*relations, scope: nil, cache: false) # rubocop:disable Style/Predi
attr_reader relation

define_method "#{relation}=" do |item|
return item if public_send(relation) == item
instance_variable_set("@#{relation}", item)

modified!(relation) if cache
Expand Down

0 comments on commit ec3021f

Please sign in to comment.