Skip to content

Commit

Permalink
Changes based on code review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Dec 5, 2018
1 parent a293d35 commit f96f523
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/lib/y2configuration_management/salt/form_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class FormController
# Constructor
#
# @param form [Y2ConfigurationManagement::Salt::Form] Form

def initialize(form)
@data = FormData.new(form)
@form = form
Expand Down Expand Up @@ -112,7 +111,7 @@ def replace_point
# Displays a popup
#
# @param title [String] Popup title
# @param contents [Array<CWM::AbstractWidget>] Popup content (as an array of CWM widgets)
# @param widget [Array<CWM::AbstractWidget>] Popup content (as an array of CWM widgets)
# @return [Hash,nil] Dialog's result
def show_popup(title, widget)
Widgets::FormPopup.new(title, widget).run
Expand Down
6 changes: 3 additions & 3 deletions src/lib/y2configuration_management/salt/form_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,15 @@ def path_to_parts(path)

# Builds a hash to keep the form data
#
# @param [Y2ConfigurationManagement::Salt::Form]
# @param form [Y2ConfigurationManagement::Salt::Form]
# @return [Hash]
def data_for_form(form)
data_for_element(form.root)
end

# Builds a hash to keep the form data
# Builds a hash to keep the form element data
#
# @param [Y2ConfigurationManagement::Salt::Form]
# @param element [Y2ConfigurationManagement::Salt::FormElement]
# @return [Hash]
def data_for_element(element)
if element.is_a?(Container)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/y2configuration_management/widgets/form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def initialize(children)
# @example Setting values for nested widgets
# form.values = { "ranges" => [ { "start" => "10.0.0.10", "end" => "10.0.0.20" } ] }
#
# @return value [Hash] New value
# @param value [Hash] New value
def value=(value)
children.each do |widget|
widget.value = value[widget.id]
Expand Down
4 changes: 2 additions & 2 deletions src/lib/y2configuration_management/widgets/group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def contents
# @example Setting values for nested widgets
# form.values = { "ranges" => [ { "start" => "10.0.0.10", "end" => "10.0.0.20" } ] }
#
# @return value [Hash] New value
# @param values [Hash] New value
def value=(values)
children.each do |widget|
widget.value = values[widget.id]
Expand All @@ -74,7 +74,7 @@ def value=(values)
# This method gets the values from the underlying widgets returning them in a
# hash index by widget ids.
#
# @return value [Hash] New value
# @return [Hash]
# @see #value=
def value
children.reduce({}) { |a, e| a.merge(e.id => e.value) }
Expand Down

0 comments on commit f96f523

Please sign in to comment.