Sha256: c4e7d8b3ce3adfbf6e364d659af56121fed129fb0ecaf6a0c49d48dc94313194
Contents?: true
Size: 537 Bytes
Versions: 7
Compression:
Stored size: 537 Bytes
Contents
# frozen_string_literal: true module Spina module Admin::Conferences::Blog # Spina::Blog::PostDecorator class PostDecorator < Draper::Decorator delegate_all def published_date l model.published_at.to_date, format: :long end def word_count h.strip_tags(content).split.size end def image_count Nokogiri::HTML(content).css('img').size end def read_time ((word_count / (275 / 60.to_f) + (image_count * 12)) / 60).ceil end end end end
Version data entries
7 entries across 7 versions & 1 rubygems