Class: Alchemrest::Result::Ok

Inherits:
Alchemrest::Result show all
Defined in:
lib/alchemrest/result.rb

Instance Method Summary collapse

Methods inherited from Alchemrest::Result

Error, Ok, [], for, #transform, #unwrap_or_raise!, #unwrap_or_rescue

Constructor Details

#initialize(value) ⇒ Ok

rubocop:disable Lint/MissingSuper



11
12
13
# File 'lib/alchemrest/result.rb', line 11

def initialize(value) # rubocop:disable Lint/MissingSuper
  self.value = value
end

Instance Method Details

#==(other) ⇒ Object



15
16
17
# File 'lib/alchemrest/result.rb', line 15

def ==(other)
  other.is_a?(Ok) && other.value == value
end

#deconstructObject



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

def deconstruct
  [value]
end

#deconstruct_keys(_keys) ⇒ Object



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

def deconstruct_keys(_keys)
  { value: }
end

#ok?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/alchemrest/result.rb', line 19

def ok?
  true
end