Sha256: 895088661bd103b2597f2e6890290775483d7f8f49a1a7c24bdb96ecb0b71c1d

Contents?: true

Size: 323 Bytes

Versions: 3

Compression:

Stored size: 323 Bytes

Contents

module Interactor
  class Context < ::Hash
    def self.build(context = {})
      self === context ? context : new.replace(context)
    end

    def success?
      !failure?
    end

    def failure?
      @failure || false
    end

    def fail!(context = {})
      update(context)
      @failure = true
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
interactor-2.0.1 lib/interactor/context.rb
interactor-2.0.0 lib/interactor/context.rb
interactor-1.0.0 lib/interactor/context.rb