Skip to content

Commit

Permalink
Changes based on CR.
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed May 31, 2021
1 parent 380fbe9 commit b70e241
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lib/y2network/proposal_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def create_instance
def load_features(source = network_section)
return unless source.is_a?(Hash)

source.keys.each { |k| load_feature(k, k, source: source) if respond_to?("#{k}=") }
source.keys.each { |k| load_feature(k, k, source: source) }
end

# Reads a feature from a given hash and assign it to the corresponding object attribute
Expand All @@ -205,8 +205,10 @@ def load_features(source = network_section)
# @param to [String, Symbol] attribute name where to store the feature value
# @param source [Hash] from where to read the feature
def load_feature(feature, to, source: network_section)
return unless respond_to?("#{to}=")

value = source[feature.to_s]
public_send("#{to}=", value) unless value.nil?
public_send("#{to}=", value)
end

# Convenience method to read the control file network section
Expand Down

0 comments on commit b70e241

Please sign in to comment.