Sha256: b566b03cabad458ba725f1cb7142d17123fff443e617dd4832ee7e89a5c0859e

Contents?: true

Size: 970 Bytes

Versions: 4

Compression:

Stored size: 970 Bytes

Contents

# frozen_string_literal: true

module ConvenientService
  module Examples
    module Standard
      module V1
        class Cowsay
          module Services
            class BuildCloud
              include ConvenientService::Standard::V1::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
end

Version data entries

4 entries across 4 versions & 1 rubygems

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