Class: Flows::Result::Ok

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

Overview

Result Object for successful 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: :ok, meta: {}) ⇒ Ok

Returns a new instance of Ok.

Since:

  • 0.4.0



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

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

Instance Method Details

#err?false

Returns:

  • (false)

Since:

  • 0.4.0



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

def err?
  false
end

#errorObject

Raises:

Since:

  • 0.4.0



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

def error
  raise AccessError, self
end

#ok?true

Returns:

  • (true)

Since:

  • 0.4.0



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

def ok?
  true
end

#unwrapObject

Since:

  • 0.4.0



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

def unwrap
  @data
end