Top Level Namespace

Defined Under Namespace

Modules: Byebug, ConvenientService

Constant Summary collapse

CS =
::ConvenientService

Instance Method Summary collapse

Instance Method Details

#b(*args) ⇒ Object

Works in a similar way as ‘p`, but for `byebug`.



7
8
9
10
11
12
13
14
# File 'lib/convenient_service/dependencies/extractions/b.rb', line 7

def b(*args)
  require "byebug"
  require "byebug/core"

  ::Byebug.attach

  args.one? ? args.first : args
end

#ceObject

Note:

‘ce` is short for `catch_exception`.

Examples:

ce { some_code }
e = ce { some_code }


10
11
12
13
14
15
16
# File 'lib/convenient_service/dependencies/extractions/ce.rb', line 10

def ce
  yield

  nil
rescue => exception
  exception
end

#ds(first_string, second_string) ⇒ nil

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.

Note:

‘ds’ is a dev-only helper.

Note:

‘ds` is a short for `diff_strings`.

Defines ‘ds` helper in order to have a quick way to find differences between strings like `git diff`.

Examples:

first_string = <<~TEXT
  Step of `AnonymousClass(#14360)` is passed as constructor argument `kwargs[:baz]` to `AnonymousClass(#14360)`.

  It is an antipattern. It neglects the idea of steps.

  Please, try to reorganize `AnonymousClass(#14400)` service.
TEXT

second_string = <<~TEXT
  Step of `AnonymousClass(#14360)` is passed as constructor argument `kwargs[:baz]` to `AnonymousClass(#14400)`.

  It is an antipattern. It neglects the idea of steps.

  Please, try to reorganize `AnonymousClass(#14400)` service.
TEXT

ds(first_string, second_string)
=>
-Step of `AnonymousClass(#14360)` is passed as constructor argument `kwargs[:baz]` to `AnonymousClass(#14360)`.
+Step of `AnonymousClass(#14360)` is passed as constructor argument `kwargs[:baz]` to `AnonymousClass(#14400)`.

It is an antipattern. It neglects the idea of steps.

Please, try to reorganize `AnonymousClass(#14400)` service.

Parameters:

  • first_string (String)
  • second_string (String)

Returns:

  • (nil)


41
42
43
44
45
# File 'lib/convenient_service/dependencies/extractions/ds.rb', line 41

def ds(first_string, second_string)
  require "diffy"

  puts ::Diffy::Diff.new(first_string, second_string).to_s(:color)
end

#erbObject



22
# File 'lib/convenient_service/dependencies/built_in.rb', line 22

require "erb"

#forwardableObject



15
# File 'lib/convenient_service/dependencies/built_in.rb', line 15

require "forwardable"

#loggerObject



29
# File 'lib/convenient_service/dependencies/built_in.rb', line 29

require "logger"

#queriesObject

This file load extracted dependencies.



17
# File 'lib/convenient_service/dependencies/only_queries.rb', line 17

require_relative "queries"

#rubygemsObject



37
# File 'lib/convenient_service/dependencies/built_in.rb', line 37

require "rubygems"

#singletonObject



44
# File 'lib/convenient_service/dependencies/built_in.rb', line 44

require "singleton"

#threadObject



51
# File 'lib/convenient_service/dependencies/built_in.rb', line 51

require "thread"