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.46 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.45 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.44 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.43 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.42 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.41 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.40 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.39 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.38 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.37 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.36 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.35 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.34 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.33 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.32 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.31 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.30 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.28 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.27 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.26 app/presenters/renalware/hd/session_access_presenter.rb