Sha256: 3e0a52d1b75d63181b4180fbf9f64f773acb8243a7d4d92de2cc5a0dd4c04675

Contents?: true

Size: 411 Bytes

Versions: 2

Compression:

Stored size: 411 Bytes

Contents

class Middleman::Blog::Similar::Algorithm
  attr_reader :article, :app
  def initialize(article)
    @article = article
  end
  def similar_articles
    @similar_articles ||= articles
      .reject{|a| a == article }
      .map{|a| [distance(a), a] }
      .sort{|x, y| x[0] <=> y[0]  }
      .map{|a| a[1] }
  end
  def distance
    0.0
  end
  def articles
    article.blog_controller.data.articles
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
middleman-blog-similar-1.1.1 lib/middleman-blog-similar/algorithm.rb
middleman-blog-similar-1.1.0 lib/middleman-blog-similar/algorithm.rb