Module: DTK::Client::Violation::Fix::SetAttribute

Defined in:
lib/violation/fix/set_attribute.rb

Class Method Summary collapse

Class Method Details

.get_input_and_apply_fix(service_id, attribute) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 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