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.25 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.24 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.23 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.22 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.21 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.20 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.18 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.17 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.16 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.15 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.14 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.13 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.12 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.11 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.9 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.8 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.7 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.5 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.4 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.3 app/presenters/renalware/hd/session_access_presenter.rb