class ZombieScout::FlogScorer

Attributes

flog[R]

Public Class Methods

new(zombie, flog=nil) click to toggle source
# File lib/zombie_scout/flog_scorer.rb, line 5
def initialize(zombie, flog=nil)
  @zombie = zombie
  @flog = flog || Flog.new(methode: true, quiet: true, score: false)
end

Public Instance Methods

score() click to toggle source
# File lib/zombie_scout/flog_scorer.rb, line 10
def score
  raw_score.round(1)
end

Private Instance Methods

raw_score() click to toggle source
# File lib/zombie_scout/flog_scorer.rb, line 18
def raw_score
  all_scores = flog.flog(zombie_path)

  # default to {} in case there is no score. (it's a 0)
  scores = all_scores.fetch(@zombie.full_name, {})

  flog.score_method(scores)
end
zombie_path() click to toggle source
# File lib/zombie_scout/flog_scorer.rb, line 27
def zombie_path
  @zombie.location.sub(/\:\d+$/, '')
end