Class: Chat::Service::Base::Context

Inherits:
OpenStruct
  • Object
show all
Defined in:
plugins/chat/app/services/base.rb

Overview

Simple structure to hold the context of the service during its whole lifecycle.

Instance Method Summary collapse

Instance Method Details

#fail(context = {}) ⇒ Context

Marks the context as failed without raising an exception.

Examples:

context.fail("failure": "something went wrong")

Parameters:

  • context (Hash, Context) (defaults to: {})

    the context to merge into the current one

Returns:

#fail!(context = {}) ⇒ Context

Marks the context as failed.

Examples:

context.fail!("failure": "something went wrong")

Parameters:

  • context (Hash, Context) (defaults to: {})

    the context to merge into the current one

Returns:

Raises:

#failure?Boolean

Returns true if the context is set as failed

Returns:

  • (Boolean)

    returns true if the context is set as failed

See Also:

#success?Boolean

Returns true if the context is set as successful (default)

Returns:

  • (Boolean)

    returns true if the context is set as successful (default)