Sha256: 154b93a43da42ff9d0d17fa3d07d40c32fb53831a27bafe3ef0250706483d167

Contents?: true

Size: 629 Bytes

Versions: 2

Compression:

Stored size: 629 Bytes

Contents

# frozen_string_literal: true

module Pcli
  module Services
    class App
      include Depends.on(
        'output',
        steps: 'all_steps'
      )

      def run
        result = nil
        prev_space = false
        steps.all.each.with_index do |step, i|
          break if result&.halt? && !step.ensured?

          output.puts if i.positive? && step.spaced? && !prev_space

          result = step.run(result)

          if i < steps.all.count - 1 && step.spaced?
            prev_space = true
            output.puts
          else
            prev_space = false
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pcli-0.1.1 lib/pcli/services/app.rb
pcli-0.1.0 lib/pcli/services/app.rb