Sha256: bb74099b6145782ace74fc9f2ee1cb09858c6284b3937cfcc4cac5229f611a23

Contents?: true

Size: 631 Bytes

Versions: 1

Compression:

Stored size: 631 Bytes

Contents

module Middleman
  module Blog
    module Similar
      module Engines
        class Base
          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 a
            0
          end
          def articles
            article.blog_controller.data.articles
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
middleman-blog-similar-1.0.0 lib/middleman-blog-similar/engines/base.rb