Sha256: bdf0860b2314e1fb2c2f4a1515d6c72195ff6b2dbb5f576957e4af76c55673ae

Contents?: true

Size: 1.32 KB

Versions: 7

Compression:

Stored size: 1.32 KB

Contents

# frozen_string_literal: true

##
# Usage example:
#
# result = ConvenientService::Examples::Standard::Gemfile::Services::Format.result(path: "Gemfile")
# result = ConvenientService::Examples::Standard::Gemfile::Services::Format.result(path: "spec/cli/gemfile/format/fixtures/Gemfile")
#
module ConvenientService
  module Examples
    module Standard
      module Gemfile
        module Services
          class Format
            include ConvenientService::Standard::Config

            attr_reader :path

            step Services::ReadFileContent, in: :path, out: :content
            step Services::StripComments, in: :content, out: :content_without_comments
            step Services::ParseContent, in: {content: :content_without_comments}, out: :parsed_content
            step Services::FormatHeader, in: :parsed_content, out: {formatted_content: :formatted_header_content}
            step Services::FormatBody, in: :parsed_content, out: {formatted_content: :formatted_body_content}

            before :result do
              @progressbar = ::ProgressBar.create(title: "Formatting", total: steps.count)
            end

            after :step do |step_result|
              @progressbar.increment
            end

            def initialize(path:)
              @path = path
            end
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
convenient_service-0.6.0 lib/convenient_service/examples/standard/gemfile/services/format.rb
convenient_service-0.5.0 lib/convenient_service/examples/standard/gemfile/services/format.rb
convenient_service-0.4.0 lib/convenient_service/examples/standard/gemfile/services/format.rb
convenient_service-0.3.1 lib/convenient_service/examples/standard/gemfile/services/format.rb
convenient_service-0.3.0 lib/convenient_service/examples/standard/gemfile/services/format.rb
convenient_service-0.2.1 lib/convenient_service/examples/standard/gemfile/services/format.rb
convenient_service-0.2.0 lib/convenient_service/examples/standard/gemfile/services/format.rb