module Fantasyhub::Feed::Scorer

Public Instance Methods

call(feed)
Alias for: score
score(feed) click to toggle source
# File lib/fantasyhub/feed/scorer.rb, line 6
def score(feed)
  feed.map do |item|
    with_score = merge_in_score(item)
    ::Fantasyhub::Event.new(with_score)
  end
end
Also aliased as: call

Private Instance Methods

merge_in_score(item) click to toggle source
# File lib/fantasyhub/feed/scorer.rb, line 16
def merge_in_score(item)
  item.merge(score: score_by_type(item[:event_type]))
end
score_by_type(event_type) click to toggle source
# File lib/fantasyhub/feed/scorer.rb, line 20
def score_by_type(event_type)
  namespace = "Fantasyhub::Events::#{event_type}"
  Object.const_get(namespace).score
end