class Smyte::Classification::Label

Attributes

name[R]
response[R]

Public Class Methods

new(name, response) click to toggle source
# File lib/smyte/classification.rb, line 30
def initialize(name, response)
  @name = name
  @response = response
end

Public Instance Methods

action() click to toggle source

returns :block, :review, :allow, :unknown

# File lib/smyte/classification.rb, line 36
def action
  @action ||= calculate_action
end
experimental?() click to toggle source
# File lib/smyte/classification.rb, line 40
def experimental?
  !response["enabled"]
end

Protected Instance Methods

calculate_action() click to toggle source
# File lib/smyte/classification.rb, line 46
def calculate_action
  return :allow if response["verdict"] == "ALLOW"

  if response["verdict"] == "BLOCK"
    if experimental?
      return :review
    else
      return :block
    end
  end

  return :unknown
end