Class: SoftValidation::SoftValidation

Inherits:
Object
  • Object
show all
Defined in:
lib/soft_validation.rb

Overview

A SoftValidation is identifies an individual issue with the instance it has been run against. It is generated by a soft_validation_method.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSoftValidation



210
211
212
# File 'lib/soft_validation.rb', line 210

def initialize
  @fixed = :fix_not_yet_run
end

Instance Attribute Details

#attributeSymbol



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/soft_validation.rb', line 207

class SoftValidation
  attr_accessor :attribute, :message, :fix, :fix_trigger, :success_message, :failure_message, :fixed

  def initialize
    @fixed = :fix_not_yet_run
  end

  def fixed?
    return true if @fixed == :fixed
    false
  end

  def result_message
    case fixed
    when :fix_not_triggered
      'fix available, but not triggered'
    when :no_fix_available
      'fix not run, no fix available'
    when :fix_not_yet_run
      'fix not yet run'
    when :fixed 
      self.success_message.nil? ? "'#{message}' was fixed (no result message provided)" : self.success_message
    when :fix_error 
      self.failure_message.nil? ? "'#{message}' was NOT fixed (no result message provided)" : self.failure_message
    end
  end
end

#failure_messageString



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/soft_validation.rb', line 207

class SoftValidation
  attr_accessor :attribute, :message, :fix, :fix_trigger, :success_message, :failure_message, :fixed

  def initialize
    @fixed = :fix_not_yet_run
  end

  def fixed?
    return true if @fixed == :fixed
    false
  end

  def result_message
    case fixed
    when :fix_not_triggered
      'fix available, but not triggered'
    when :no_fix_available
      'fix not run, no fix available'
    when :fix_not_yet_run
      'fix not yet run'
    when :fixed 
      self.success_message.nil? ? "'#{message}' was fixed (no result message provided)" : self.success_message
    when :fix_error 
      self.failure_message.nil? ? "'#{message}' was NOT fixed (no result message provided)" : self.failure_message
    end
  end
end

#fixSymbol



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/soft_validation.rb', line 207

class SoftValidation
  attr_accessor :attribute, :message, :fix, :fix_trigger, :success_message, :failure_message, :fixed

  def initialize
    @fixed = :fix_not_yet_run
  end

  def fixed?
    return true if @fixed == :fixed
    false
  end

  def result_message
    case fixed
    when :fix_not_triggered
      'fix available, but not triggered'
    when :no_fix_available
      'fix not run, no fix available'
    when :fix_not_yet_run
      'fix not yet run'
    when :fixed 
      self.success_message.nil? ? "'#{message}' was fixed (no result message provided)" : self.success_message
    when :fix_error 
      self.failure_message.nil? ? "'#{message}' was NOT fixed (no result message provided)" : self.failure_message
    end
  end
end

#fix_triggerSymbol



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/soft_validation.rb', line 207

class SoftValidation
  attr_accessor :attribute, :message, :fix, :fix_trigger, :success_message, :failure_message, :fixed

  def initialize
    @fixed = :fix_not_yet_run
  end

  def fixed?
    return true if @fixed == :fixed
    false
  end

  def result_message
    case fixed
    when :fix_not_triggered
      'fix available, but not triggered'
    when :no_fix_available
      'fix not run, no fix available'
    when :fix_not_yet_run
      'fix not yet run'
    when :fixed 
      self.success_message.nil? ? "'#{message}' was fixed (no result message provided)" : self.success_message
    when :fix_error 
      self.failure_message.nil? ? "'#{message}' was NOT fixed (no result message provided)" : self.failure_message
    end
  end
end

#fixedSymbol



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/soft_validation.rb', line 207

class SoftValidation
  attr_accessor :attribute, :message, :fix, :fix_trigger, :success_message, :failure_message, :fixed

  def initialize
    @fixed = :fix_not_yet_run
  end

  def fixed?
    return true if @fixed == :fixed
    false
  end

  def result_message
    case fixed
    when :fix_not_triggered
      'fix available, but not triggered'
    when :no_fix_available
      'fix not run, no fix available'
    when :fix_not_yet_run
      'fix not yet run'
    when :fixed 
      self.success_message.nil? ? "'#{message}' was fixed (no result message provided)" : self.success_message
    when :fix_error 
      self.failure_message.nil? ? "'#{message}' was NOT fixed (no result message provided)" : self.failure_message
    end
  end
end

#messageString



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/soft_validation.rb', line 207

class SoftValidation
  attr_accessor :attribute, :message, :fix, :fix_trigger, :success_message, :failure_message, :fixed

  def initialize
    @fixed = :fix_not_yet_run
  end

  def fixed?
    return true if @fixed == :fixed
    false
  end

  def result_message
    case fixed
    when :fix_not_triggered
      'fix available, but not triggered'
    when :no_fix_available
      'fix not run, no fix available'
    when :fix_not_yet_run
      'fix not yet run'
    when :fixed 
      self.success_message.nil? ? "'#{message}' was fixed (no result message provided)" : self.success_message
    when :fix_error 
      self.failure_message.nil? ? "'#{message}' was NOT fixed (no result message provided)" : self.failure_message
    end
  end
end

#success_messageString



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/soft_validation.rb', line 207

class SoftValidation
  attr_accessor :attribute, :message, :fix, :fix_trigger, :success_message, :failure_message, :fixed

  def initialize
    @fixed = :fix_not_yet_run
  end

  def fixed?
    return true if @fixed == :fixed
    false
  end

  def result_message
    case fixed
    when :fix_not_triggered
      'fix available, but not triggered'
    when :no_fix_available
      'fix not run, no fix available'
    when :fix_not_yet_run
      'fix not yet run'
    when :fixed 
      self.success_message.nil? ? "'#{message}' was fixed (no result message provided)" : self.success_message
    when :fix_error 
      self.failure_message.nil? ? "'#{message}' was NOT fixed (no result message provided)" : self.failure_message
    end
  end
end

Instance Method Details

#fixed?Boolean



214
215
216
217
# File 'lib/soft_validation.rb', line 214

def fixed?
  return true if @fixed == :fixed
  false
end

#result_messageObject



219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/soft_validation.rb', line 219

def result_message
  case fixed
  when :fix_not_triggered
    'fix available, but not triggered'
  when :no_fix_available
    'fix not run, no fix available'
  when :fix_not_yet_run
    'fix not yet run'
  when :fixed 
    self.success_message.nil? ? "'#{message}' was fixed (no result message provided)" : self.success_message
  when :fix_error 
    self.failure_message.nil? ? "'#{message}' was NOT fixed (no result message provided)" : self.failure_message
  end
end