Sha256: b098e43d8f7580d9b7bcc90990d953671a6ba5f271cecfb4d8e65b39bd37e510

Contents?: true

Size: 586 Bytes

Versions: 5

Compression:

Stored size: 586 Bytes

Contents

# frozen_string_literal: true

require "dry/monads"

module Gemsmith
  module Tools
    # Views a gem within default browser.
    class Viewer
      include Dry::Monads[:result]

      def initialize container: Container
        @container = container
      end

      def call specification
        executor.capture3("open", specification.homepage_url).then do |_stdout, stderr, status|
          status.success? ? Success(specification) : Failure(stderr)
        end
      end

      private

      attr_reader :container

      def executor = container[__method__]
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gemsmith-17.0.1 lib/gemsmith/tools/viewer.rb
gemsmith-17.0.0 lib/gemsmith/tools/viewer.rb
gemsmith-16.2.0 lib/gemsmith/tools/viewer.rb
gemsmith-16.1.0 lib/gemsmith/tools/viewer.rb
gemsmith-16.0.0 lib/gemsmith/tools/viewer.rb