Sha256: 1c50fb6e11c1b720d55f1018be863da57db1b4178212a53b738c4767704b3c7e
Contents?: true
Size: 1.18 KB
Versions: 10
Compression:
Stored size: 1.18 KB
Contents
module ForemanOpenscap module Oval class SetupCheck attr_reader :result, :id, :title, :errors def initialize(hash) @id = hash[:id] @title = hash[:title] @fail_msg = hash[:fail_msg] @errors = hash[:errors] @result = :skip end def fail_with!(fail_data) @fail_msg_data = fail_data fail! end def fail! raise 'Cannot fail a check that expects fail message data, use fail_with! method instead' if @fail_msg.respond_to?(:call) && @fail_msg_data.empty? @result = :fail self end def pass! @result = :pass self end def failed? @result == :fail end def passed? @result == :pass end def skipped? @result == :skip end def fail_msg return unless failed? return @fail_msg.call(@fail_msg_data) if @fail_msg.respond_to?(:call) && @fail_msg_data @fail_msg end def to_h { :title => @title, :result => @result, :fail_message => failed? ? fail_msg : nil, :errors => @errors } end end end end
Version data entries
10 entries across 10 versions & 1 rubygems