Sha256: 70e8951a4943a59d35f20dcc815cd1bf37627ef84d7c57c6265856f7ac0b5971

Contents?: true

Size: 776 Bytes

Versions: 8

Compression:

Stored size: 776 Bytes

Contents

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

8 entries across 8 versions & 1 rubygems

Version Path
renalware-core-2.0.0.pre.rc11 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.0.pre.rc10 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.0.pre.rc9 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.0.pre.rc8 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.0.pre.rc7 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.0.pre.rc6 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.0.pre.rc5 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.0.pre.rc4 app/presenters/renalware/hd/session_access_presenter.rb