Top Level Namespace

Defined Under Namespace

Modules: Byebug, ConvenientService

Instance Method Summary collapse

Instance Method Details

#b(*args) ⇒ Object

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



12
13
14
15
16
17
18
19
# File 'lib/convenient_service/dependencies/extractions/b.rb', line 12

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

  ::Byebug.attach

  args.one? ? args.first : args
end

#bb(*args) ⇒ Object

Works in a similar way as p, but for binding.break.



13
14
15
16
17
18
19
# File 'lib/convenient_service/dependencies/extractions/bb.rb', line 13

def bb(*args)
  require "debug"

  binding.break(up_level: 2)

  args.one? ? args.first : args
end

#ceObject

Note:

ce is short for catch_exception.

Examples:

ce { some_code }
e = ce { some_code }


15
16
17
18
19
20
21
# File 'lib/convenient_service/dependencies/extractions/ce.rb', line 15

def ce
  yield

  nil
rescue => exception
  exception
end

#convenient_serviceObject

NOTE: This file is loaded by require "convenient_service/extras/plugins/assigns_attributes_in_constructor/using_active_model_attribute_assignment". NOTE: This file is expected to be called from app entry points like initializers in Rails.



13
# File 'lib/convenient_service/extras/alias.rb', line 13

require "convenient_service"

#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)


46
47
48
49
50
# File 'lib/convenient_service/dependencies/extractions/ds.rb', line 46

def ds(first_string, second_string)
  require "diffy"

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

#erbObject



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

require "erb"

#forwardableObject



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

require "forwardable"

#loggerObject



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

require "logger"

#pathnameObject



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

require "pathname"

#queriesObject

This file load extracted dependencies.



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

require_relative "queries"

#rubygemsObject



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

require "rubygems"

#singletonObject



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

require "singleton"

#threadObject



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

require "thread"