Sha256: 7f69d98808ae77feb477b492b749f3700c41f184a1f00ae19f45ba88fffd2769

Contents?: true

Size: 807 Bytes

Versions: 44

Compression:

Stored size: 807 Bytes

Contents

# frozen_string_literal: true

module Renalware
  module HD
    class SessionAccessPresenter
      def initialize(session)
        @session = session
      end

      def to_s
        return "" unless info
        [
          info.access_type,
          info.access_side&.capitalize
        ].compact.join("<br/>")
      end

      def to_html
        return "" unless info
        [
          abbreviated_type,
          abbreviated_side
        ].compact.join("/").html_safe
      end

      private

      attr_reader :session

      def info
        @info ||= session&.document&.info
      end

      def abbreviated_type
        info.access_type_abbreviation
      end

      def abbreviated_side
        return if info.access_side.blank?
        info.access_side[0].upcase
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
renalware-core-2.0.2 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.1 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.0 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.0.pre.rc13 app/presenters/renalware/hd/session_access_presenter.rb