Class: Algo

Inherits:
Object
  • Object
show all
Defined in:
lib/phisher/algo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(weight) ⇒ Algo

Creates a new instance of the algorithm with the given weight

Arguments:

{float} weight    the weight assigned to this algorithm.


10
11
12
# File 'lib/phisher/algo.rb', line 10

def initialize(weight)
  @weight = weight
end

Instance Attribute Details

#weightObject (readonly)

Returns the value of attribute weight.



3
4
5
# File 'lib/phisher/algo.rb', line 3

def weight
  @weight
end

Instance Method Details

#risk(url) ⇒ Object

Calculates the risk that a given url is phishy or safe.

Risk is measured from 0 to 1 both inclusive where a risk of 0 means that the url is completely safe and a risk of 1 means that the url is completely phishy

Arguments:

{string} url    The url whose risk will be calculated

Returns:

A float in [0..1] indicating the risk of the given url


26
27
28
# File 'lib/phisher/algo.rb', line 26

def risk(url)
  raise 'Subclasses must override risk(url) method'
end