Sha256: fcfa3d3a61f93a14b8df3b28b481470beb38a1da6048e779486052e57e7950ee

Contents?: true

Size: 879 Bytes

Versions: 253

Compression:

Stored size: 879 Bytes

Contents

module Actions
  module Helpers
    # Delegate task information to presenter object
    module Presenter
      def presenter
        fail NotImplementedError
      end

      delegate :humanized_output, to: :presenter

      class Base
        include Algebrick::TypeCheck

        attr_reader :action

        def initialize(action)
          @action = action
        end

        def humanized_output
          fail NotImplementedError
        end
      end

      # Use sub-actions for presenting the data of the task
      class Delegated < Base
        def initialize(_action, delegated_actions)
          (Type! delegated_actions, Array).all? { |a| Type! a, Presenter }
          @delegated_actions = delegated_actions
        end

        def humanized_output
          @delegated_actions.map(&:humanized_output).compact.join("\n")
        end
      end
    end
  end
end

Version data entries

253 entries across 253 versions & 1 rubygems

Version Path
katello-4.16.0 app/lib/actions/helpers/presenter.rb
katello-4.15.1 app/lib/actions/helpers/presenter.rb
katello-4.16.0.rc2 app/lib/actions/helpers/presenter.rb
katello-4.16.0.rc1 app/lib/actions/helpers/presenter.rb
katello-4.14.3 app/lib/actions/helpers/presenter.rb
katello-4.14.2 app/lib/actions/helpers/presenter.rb
katello-4.15.0 app/lib/actions/helpers/presenter.rb
katello-4.15.0.rc2 app/lib/actions/helpers/presenter.rb
katello-4.15.0.rc1 app/lib/actions/helpers/presenter.rb
katello-4.14.1 app/lib/actions/helpers/presenter.rb
katello-4.14.0 app/lib/actions/helpers/presenter.rb
katello-4.14.0.rc3 app/lib/actions/helpers/presenter.rb
katello-4.14.0.rc2 app/lib/actions/helpers/presenter.rb
katello-4.14.0.rc1.1 app/lib/actions/helpers/presenter.rb
katello-4.14.0.rc1 app/lib/actions/helpers/presenter.rb
katello-4.13.1 app/lib/actions/helpers/presenter.rb
katello-4.13.0 app/lib/actions/helpers/presenter.rb
katello-4.12.1 app/lib/actions/helpers/presenter.rb
katello-4.13.0.rc1 app/lib/actions/helpers/presenter.rb
katello-4.12.0 app/lib/actions/helpers/presenter.rb