Module: RawgApi::Extensions::DryMonads

Included in:
RawgApi::Entities::BaseEntity
Defined in:
lib/rawg_api/extensions/dry_monads.rb

Instance Method Summary collapse

Instance Method Details

#from_success(value) ⇒ Object



5
6
7
8
# File 'lib/rawg_api/extensions/dry_monads.rb', line 5

def from_success(value)
  return Dry::Monads::Success(nil) if value.nil?
  value.is_a?(Array) || value[:results].is_a?(Array) ? collection(value) : new(value)
end