Sha256: 3e42266a85657fbaeb271787bffe01d80eb7c613fd6197fdca5dfaa3df11cd1a

Contents?: true

Size: 614 Bytes

Versions: 1

Compression:

Stored size: 614 Bytes

Contents

# frozen_string_literal: true

module ActionMan
  class Result
    attr_reader :status, :params, :errors, :output

    class << self
      def success(params: {}, output: nil)
        new(:success, params:, output:)
      end

      def failure(errors: {}, output: nil)
        new(:failure, errors:, output:)
      end
    end

    def initialize(status, params: {}, errors: {}, output: nil)
      @status = status.to_sym
      @params = params
      @errors = errors
      @output = output
    end

    def success?
      @status == :success
    end

    def failure?
      @status == :failure
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
action_man-0.0.1 lib/action_man/result.rb