module Smyte::LabelReporter
Public Instance Methods
action()
click to toggle source
returns :block, :review, :allow, :unknown
# File lib/smyte/label_reporter.rb, line 7 def action @action ||= calculate_action end
label_actions()
click to toggle source
# File lib/smyte/label_reporter.rb, line 15 def label_actions return @label_actions if @label_actions found = Hash.new { |hash, key| hash[key] = [] } labels.each do |label| found[label.action] << label end @label_actions = found end
label_report()
click to toggle source
# File lib/smyte/label_reporter.rb, line 25 def label_report return @label_report if @label_report out = [] labels.each do |label| case label.action when :block, :review out << label.name end end @label_report = out end
labels()
click to toggle source
# File lib/smyte/label_reporter.rb, line 11 def labels @labels ||= parse_labels end
reset_labels()
click to toggle source
# File lib/smyte/label_reporter.rb, line 39 def reset_labels remove_instance_variable(:@label_report) if defined?(@label_report) remove_instance_variable(:@label_actions) if defined?(@label_actions) remove_instance_variable(:@labels) if defined?(@labels) remove_instance_variable(:@action) if defined?(@action) end
Protected Instance Methods
calculate_action()
click to toggle source
# File lib/smyte/label_reporter.rb, line 48 def calculate_action if label_actions[:block].size > 0 return :block elsif label_actions[:review].size > 0 return :review else return :allow end end