Sha256: f42325c43f84835ba3865771e44e63f0ab0087344f87686854639a40aa7bf6a0

Contents?: true

Size: 436 Bytes

Versions: 2

Compression:

Stored size: 436 Bytes

Contents

module Reviewed
  class Article < Base
    def find_page(slug)
      pages.find { |page| page.slug.match(/#{slug}/i) }
    end

    def attachments(tag=nil)
      if tag.present?
        @attributes[:attachments].select do |attachment|
          attachment_tags = attachment.tags || []
          attachment_tags.map(&:downcase).include?(tag.downcase)
        end
      else
        @attributes[:attachments]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
reviewed-0.0.2 lib/reviewed/article.rb
reviewed-0.0.1 lib/reviewed/article.rb