module DTK::Client::Violation::Fix::SetAttribute

Public Class Methods

get_input_and_apply_fix(service_id, attribute) click to toggle source
# File lib/violation/fix/set_attribute.rb, line 22
def self.get_input_and_apply_fix(service_id, attribute)
  prompt_response = attribute.prompt_user_for_value
  if prompt_response.response_type == :skipped
    # TODO: may distinguish between skip current and skip all; now treating everything as skip all
    return Result.skip_all
  end
  
  prompted_value = prompt_response.value
  if error_msg = attribute.illegal_value?(prompted_value)
    Result.error :error_msg => error_msg
  else
    attribute.set_attribute(service_id, prompted_value)
  end
end