Sha256: bee02a5c21c7604ba87dbd15873593c5bf46d194f4396efd25e9a759b302a197

Contents?: true

Size: 884 Bytes

Versions: 5

Compression:

Stored size: 884 Bytes

Contents

# frozen_string_literal: true

module ConvenientService
  module Examples
    module Standard
      class Cowsay
        module Services
          class BuildCloud
            include ConvenientService::Standard::Config

            attr_reader :text

            def initialize(text: "Hello World!")
              @text = text
            end

            def result
              success(cloud: cloud)
            end

            private

            ##
            # Copied with ❤️ from https://github.com/gaborbata/rosetta-cow
            #
            def cloud
              <<~HEREDOC
                 #{border(text, "_")}
                < #{text} >
                 #{border(text, "-")}
              HEREDOC
            end

            def border(text, char)
              char * (text.length + 2)
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
convenient_service-0.17.0 lib/convenient_service/examples/standard/cowsay/services/build_cloud.rb
convenient_service-0.16.0 lib/convenient_service/examples/standard/cowsay/services/build_cloud.rb
convenient_service-0.15.0 lib/convenient_service/examples/standard/cowsay/services/build_cloud.rb
convenient_service-0.14.0 lib/convenient_service/examples/standard/cowsay/services/build_cloud.rb
convenient_service-0.13.0 lib/convenient_service/examples/standard/cowsay/services/build_cloud.rb