class ObjectAttorney::Accusation

Public Class Methods

new(validation, attorney, defendant) click to toggle source
# File lib/object_attorney/accusation.rb, line 3
def initialize(validation, attorney, defendant)
  @attorney = attorney
  @defendant = defendant
  @validation = validation
end

Public Instance Methods

founded() click to toggle source
# File lib/object_attorney/accusation.rb, line 16
def founded
  return true if options[:if].nil? && options[:unless].nil?

  if_condition_true || unless_condition_true
end
sustained?() click to toggle source
# File lib/object_attorney/accusation.rb, line 9
def sustained?
  @validation.attorney = @attorney if @validation.respond_to?(:attorney=)

  # expected to be an ActiveModel::Validations::<Class> instance
  @validation.validate(@defendant)
end