class Noteikumi::Result
Represents the result of running a specific rule
Attributes
end_time[R]
The time the rule ended @return [Time,nil]
exception[RW]
The exception a rule raised @return [Exception,nil]
output[RW]
Any output produced by the rule
rule[R]
The rule the result relates to @return [Rule,nil]
run_time[R]
The time it took for the rule to be processed @return [Float]
start_time[R]
The time the rule started @return [Time,nil]
Public Class Methods
new(rule)
click to toggle source
Creates a result for a rule
@param rule [Rule] @return [Result]
# File lib/noteikumi/result.rb, line 35 def initialize(rule) @rule = rule @start_time = nil @end_time = nil @run_time = nil @exception = nil @output = nil @ran = false end
Public Instance Methods
error?()
click to toggle source
If the result has an exception
@return [Boolean]
# File lib/noteikumi/result.rb, line 55 def error? !!exception end
name()
click to toggle source
The rule name
@return [String,Symbol]
# File lib/noteikumi/result.rb, line 48 def name @rule.name end
ran?()
click to toggle source
Determines if this rule ran
@return [Boolean]
# File lib/noteikumi/result.rb, line 62 def ran? @ran end
start_processing()
click to toggle source
Records the start time for the rule process
@return [Time]
# File lib/noteikumi/result.rb, line 69 def start_processing @ran = true @start_time = Time.now end
stop_processing()
click to toggle source
Records that processing have ended
@return [Time]
# File lib/noteikumi/result.rb, line 77 def stop_processing @end_time = Time.now @run_time = @end_time - @start_time end