Module: FService

Defined in:
lib/f_service.rb,
lib/f_service/base.rb,
lib/f_service/errors.rb,
lib/f_service/version.rb,
lib/f_service/result/base.rb,
lib/f_service/result/failure.rb,
lib/f_service/result/success.rb

Overview

A small, monad-based service class

Defined Under Namespace

Modules: Result Classes: Base, Error

Constant Summary collapse

VERSION =

Current version of the gem

'0.3.1'

Class Method Summary collapse

Class Method Details

.deprecate!(name:, alternative:, from: nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Marks a method as deprecated



12
13
14
15
16
17
18
19
# File 'lib/f_service.rb', line 12

def self.deprecate!(name:, alternative:, from: nil)
  warn_message = ["\n[DEPRECATED] #{name} is deprecated; "]
  warn_message << ["called from #{from}; "] unless from.nil?
  warn_message << "use #{alternative} instead. "
  warn_message << 'It will be removed on the next release.'

  warn warn_message.join("\n")
end

.deprecate_argument_name(name:, argument_name:, alternative:, from: nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Marks an argument as deprecated



24
25
26
27
28
29
30
31
# File 'lib/f_service.rb', line 24

def self.deprecate_argument_name(name:, argument_name:, alternative:, from: nil)
  warn_message = ["\n[DEPRECATED] #{name} passing #{argument_name.inspect} is deprecated; "]
  warn_message << ["called from #{from}; "] unless from.nil?
  warn_message << "use #{alternative} instead. "
  warn_message << 'It will be removed on the next release.'

  warn warn_message.join("\n")
end