Sha256: 2c50b1a8a136f779875ced264258816ae1cdee35b6c1c057738abbc5395bc726

Contents?: true

Size: 604 Bytes

Versions: 1

Compression:

Stored size: 604 Bytes

Contents

# frozen_string_literal: true

class PgExport
  module ValueObjects
    class Result
      attr_reader :value

      def initialize(value)
        @value = value
      end
    end

    class Success < Result
      def success
        value
      end

      def bind
        yield
      end

      def on_success
        yield value

        self
      end

      def on_failure
        self
      end
    end

    class Failure < Result
      def bind
        self
      end

      def on_success
        self
      end

      def on_failure
        yield value

        self
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pg_export-1.0.0.rc6 lib/pg_export/lib/pg_export/value_objects/result.rb