Class: Flows::Result::Err

Inherits:
Flows::Result show all
Defined in:
lib/flows/result/err.rb

Overview

Result Object for failure results.

See Also:

Since:

  • 0.4.0

Instance Attribute Summary

Attributes inherited from Flows::Result

#meta, #status

Instance Method Summary collapse

Methods inherited from Flows::Result

#==

Constructor Details

#initialize(data, status: :err, meta: {}) ⇒ Err

Returns a new instance of Err.

Since:

  • 0.4.0



7
8
9
10
11
# File 'lib/flows/result/err.rb', line 7

def initialize(data, status: :err, meta: {})
  @data = data
  @status = status
  @meta = meta
end

Instance Method Details

#err?true

Returns:

  • (true)

Since:

  • 0.4.0



23
24
25
# File 'lib/flows/result/err.rb', line 23

def err?
  true
end

#errorObject

Since:

  • 0.4.0



13
14
15
# File 'lib/flows/result/err.rb', line 13

def error
  @data
end

#ok?false

Returns:

  • (false)

Since:

  • 0.4.0



18
19
20
# File 'lib/flows/result/err.rb', line 18

def ok?
  false
end

#unwrapObject

Raises:

Since:

  • 0.4.0



27
28
29
# File 'lib/flows/result/err.rb', line 27

def unwrap
  raise AccessError, self
end