Sha256: cf6a3173e08af04a40ddb711855bf21d13687e01578fe77e36a45684879f1ab7

Contents?: true

Size: 722 Bytes

Versions: 1

Compression:

Stored size: 722 Bytes

Contents

require "attr_extras"

module Renalware
  # A base class for Summary presenters in other name-spaces. SummaryParts can be composed into
  # reporting dashboards or summary pages. The Clinical Summary for instance comprises an array
  # of various SummaryParts
  class SummaryPart
    rattr_initialize :patient
    attr_implement :to_partial_path

    # If the subclass defines a cache_key Rails will cache the partial
    def cache_key
      nil
    end

    def cache?
      cache_key.present?
    end

    def render?
      true
    end

    protected

    def title_friendly_collection_count(actual:, total:)
      if total > actual
        "#{actual} of #{total}"
      else
        actual
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.rc10 app/presenters/renalware/summary_part.rb