Sha256: aea1241f737941a18b00135526f92020f5c526ebefb4c8bd5d86496ce058ac1a

Contents?: true

Size: 795 Bytes

Versions: 8

Compression:

Stored size: 795 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.try!(: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.try!(:document).try!(: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.beta11 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.0.pre.beta10 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.0.pre.beta9 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.0.pre.beta8 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.0.pre.beta7 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.0.pre.beta6 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.0.pre.beta5 app/presenters/renalware/hd/session_access_presenter.rb
renalware-core-2.0.0.pre.beta4 app/presenters/renalware/hd/session_access_presenter.rb