Module: ConvenientService::Dependencies

Defined in:
lib/convenient_service/dependencies.rb,
lib/convenient_service/dependencies/extractions/active_support_concern/concern.rb,
lib/convenient_service/dependencies/extractions/ruby_middleware/middleware/logger.rb,
lib/convenient_service/dependencies/extractions/ruby_middleware/middleware/runner.rb,
lib/convenient_service/dependencies/extractions/ruby_middleware/middleware/builder.rb,
lib/convenient_service/dependencies/extractions/active_support_backtrace_cleaner/backtrace_cleaner.rb

Defined Under Namespace

Modules: Extractions

Class Method Summary collapse

Class Method Details

.active_modelConvenientService::Support::Gems::ActiveModel

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.



430
431
432
# File 'lib/convenient_service/dependencies.rb', line 430

def active_model
  Support::Gems::ActiveModel
end

.loggerConvenientService::Support::Gems::Logger

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.



439
440
441
# File 'lib/convenient_service/dependencies.rb', line 439

def logger
  Support::Gems::Logger
end

.paintConvenientService::Support::Gems::Paint

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.



448
449
450
# File 'lib/convenient_service/dependencies.rb', line 448

def paint
  Support::Gems::Paint
end

.require_aliasBoolean

Note:

Expected to be called from app entry points like ‘initializers` in Rails.

Returns:

  • (Boolean)


45
46
47
# File 'lib/convenient_service/dependencies.rb', line 45

def require_alias
  require_relative "alias"
end

.require_assigns_attributes_in_constructor_using_active_model_attribute_assignmentBoolean

Note:

Expected to be called from app entry points like ‘initializers` in Rails.

Returns:

  • (Boolean)


55
56
57
58
59
60
61
62
63
64
# File 'lib/convenient_service/dependencies.rb', line 55

def require_assigns_attributes_in_constructor_using_active_model_attribute_assignment
  ##
  # - https://edgeguides.rubyonrails.org/active_model_basics.html
  # - https://api.rubyonrails.org/classes/ActiveModel.html
  # - https://github.com/rails/rails/tree/main/activemodel
  #
  require "active_model"

  require_relative "common/plugins/assigns_attributes_in_constructor/using_active_model_attribute_assignment"
end

.require_assigns_attributes_in_constructor_using_dry_initializerBoolean

Note:

Expected to be called from app entry points like ‘initializers` in Rails.

Returns:

  • (Boolean)


72
73
74
75
76
77
78
79
80
# File 'lib/convenient_service/dependencies.rb', line 72

def require_assigns_attributes_in_constructor_using_dry_initializer
  ##
  # - https://dry-rb.org/gems/dry-initializer/main
  # - https://github.com/dry-rb/dry-initializer
  #
  require "dry-initializer"

  require_relative "common/plugins/assigns_attributes_in_constructor/using_dry_initializer"
end

.require_awesome_print_inspectBoolean

Note:

Expected to be called from app entry points like ‘initializers` in Rails.

Returns:

  • (Boolean)


115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/convenient_service/dependencies.rb', line 115

def require_awesome_print_inspect
  ##
  # - https://github.com/awesome-print/awesome_print
  #
  require "awesome_print"

  require_relative "service/plugins/has_awesome_print_inspect"
  require_relative "service/plugins/has_j_send_result/entities/result/plugins/has_awesome_print_inspect"
  require_relative "service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/plugins/has_awesome_print_inspect"
  require_relative "service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/plugins/has_awesome_print_inspect"
  require_relative "service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins/has_awesome_print_inspect"
  require_relative "service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/plugins/has_awesome_print_inspect"
  require_relative "service/plugins/can_have_steps/entities/step/plugins/has_awesome_print_inspect"
  require_relative "service/configs/awesome_print_inspect"
  require_relative "service/configs/awesome_print_inspect/aliases"
end

.require_can_utilize_finite_loopBoolean

Note:

Expected to be called from app entry points like ‘initializers` in Rails.

Returns:

  • (Boolean)


88
89
90
# File 'lib/convenient_service/dependencies.rb', line 88

def require_can_utilize_finite_loop
  require_relative "common/plugins/can_utilize_finite_loop"
end

.require_development_toolsBoolean

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:

Expected to be called from ‘irb`, `pry`, `spec_helper.rb`, etc.

Returns:

  • (Boolean)


205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# File 'lib/convenient_service/dependencies.rb', line 205

def require_development_tools
  ##
  # - https://github.com/awesome-print/awesome_print
  #
  require "awesome_print"

  ##
  # - https://github.com/gsamokovarov/break
  #
  require "break"

  ##
  # - https://github.com/deivid-rodriguez/byebug
  #
  require "byebug" unless ruby.jruby?

  ##
  # - https://github.com/ruby/debug
  #
  require "debug" unless ruby.jruby?

  ##
  # - https://ruby-doc.org/stdlib-2.7.0/libdoc/ostruct/rdoc/OpenStruct.html
  # - https://github.com/ruby/ostruct
  #
  require "ostruct"

  ##
  # - https://github.com/janlelis/paint
  #
  require "paint"

  ##
  # - https://github.com/rouge-ruby/rouge
  #
  require "rouge"

  ##
  # - https://ruby-doc.org/stdlib-2.7.0/libdoc/tempfile/rdoc/Tempfile.html
  # - https://github.com/ruby/tempfile
  #
  require "tempfile"

  ##
  # - https://gist.github.com/marian13/5dade20a431d7254db30e543167058ce
  #
  require_relative "dependencies/extractions/byebug_syntax_highlighting" unless ruby.jruby?

  require_relative "dependencies/extractions/b" unless ruby.jruby?

  ##
  #
  #
  require_relative "dependencies/extractions/ce"
end

.require_dry_examples(version: "") ⇒ Boolean

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.

Loads dry config examples.

Parameters:

  • version (String) (defaults to: "")

Returns:

  • (Boolean)


386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
# File 'lib/convenient_service/dependencies.rb', line 386

def require_dry_examples(version: "")
  ##
  # - https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html
  # - https://github.com/flori/json
  #
  require "json"

  ##
  # - https://github.com/jfelchner/ruby-progressbar
  #
  require "progressbar"

  ##
  # - https://ruby-doc.org/stdlib-2.7.0/libdoc/webrick/rdoc/WEBrick.html
  # - https://github.com/ruby/webrick
  #
  require "webrick"

  require_relative ::File.join("examples", "dry", version, "gemfile")
end

.require_has_attributes_using_active_model_attributesBoolean

Note:

Expected to be called from app entry points like ‘initializers` in Rails.

Returns:

  • (Boolean)


98
99
100
101
102
103
104
105
106
107
# File 'lib/convenient_service/dependencies.rb', line 98

def require_has_attributes_using_active_model_attributes
  ##
  # - https://edgeguides.rubyonrails.org/active_model_basics.html
  # - https://api.rubyonrails.org/classes/ActiveModel.html
  # - https://github.com/rails/rails/tree/main/activemodel
  #
  require "active_model"

  require_relative "common/plugins/has_attributes/using_active_model_attributes"
end

.require_has_j_send_result_params_validations_using_active_model_validationsBoolean

Note:

Expected to be called from app entry points like ‘initializers` in Rails.



140
141
142
143
144
145
146
147
148
149
# File 'lib/convenient_service/dependencies.rb', line 140

def require_has_j_send_result_params_validations_using_active_model_validations
  ##
  # - https://edgeguides.rubyonrails.org/active_model_basics.html
  # - https://api.rubyonrails.org/classes/ActiveModel.html
  # - https://github.com/rails/rails/tree/main/activemodel
  #
  require "active_model"

  require_relative "service/plugins/has_j_send_result_params_validations/using_active_model_validations"
end

.require_has_j_send_result_params_validations_using_dry_validationBoolean

Note:

Expected to be called from app entry points like ‘initializers` in Rails.

Returns:

  • (Boolean)


157
158
159
160
161
162
163
164
165
# File 'lib/convenient_service/dependencies.rb', line 157

def require_has_j_send_result_params_validations_using_dry_validation
  ##
  # - https://dry-rb.org/gems/dry-validation/main/
  # - https://github.com/dry-rb/dry-validation
  #
  require "dry-validation"

  require_relative "service/plugins/has_j_send_result_params_validations/using_dry_validation"
end

.require_rails_examples(version: "") ⇒ Boolean

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.

Loads rails config examples.

Parameters:

  • version (String) (defaults to: "")

Returns:

  • (Boolean)


357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
# File 'lib/convenient_service/dependencies.rb', line 357

def require_rails_examples(version: "")
  ##
  # - https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html
  # - https://github.com/flori/json
  #
  require "json"

  ##
  # - https://github.com/jfelchner/ruby-progressbar
  #
  require "progressbar"

  ##
  # - https://ruby-doc.org/stdlib-2.7.0/libdoc/webrick/rdoc/WEBrick.html
  # - https://github.com/ruby/webrick
  #
  require "webrick"

  require_relative ::File.join("examples", "rails", version, "gemfile")
end

.require_rescues_result_unhandled_exceptionsBoolean

Note:

Expected to be called from app entry points like ‘initializers` in Rails.

Returns:

  • (Boolean)


173
174
175
# File 'lib/convenient_service/dependencies.rb', line 173

def require_rescues_result_unhandled_exceptions
  require_relative "service/plugins/rescues_result_unhandled_exceptions"
end

.require_rspec_extentionsBoolean

Note:

Expected to be called from ‘spec_helper.rb`.

Loads RSpec extensions like ‘be_success` matcher, `stub_service` helper, etc.

Returns:

  • (Boolean)


294
295
296
297
298
299
300
# File 'lib/convenient_service/dependencies.rb', line 294

def require_rspec_extentions
  require "rspec/expectations"
  require "rspec/matchers"
  require "rspec/mocks"

  require_relative "rspec"
end

.require_standard_examples(version: "") ⇒ Boolean

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.

Loads standard config examples.

Parameters:

  • version (String) (defaults to: "")

Returns:

  • (Boolean)


310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# File 'lib/convenient_service/dependencies.rb', line 310

def require_standard_examples(version: "")
  ##
  # - https://ruby-doc.org/stdlib-2.7.0/libdoc/date/rdoc/Date.html
  # - https://ruby-doc.org/stdlib-2.7.0/libdoc/date/rdoc/DateTime.html
  # - https://github.com/ruby/date
  #
  require "date"

  ##
  # - https://ruby-doc.org/stdlib-2.7.0/libdoc/json/rdoc/JSON.html
  # - https://github.com/flori/json
  #
  require "json"

  ##
  # - https://github.com/jfelchner/ruby-progressbar
  #
  require "progressbar"

  ##
  # - https://ruby-doc.org/stdlib-2.7.0/libdoc/webrick/rdoc/WEBrick.html
  # - https://github.com/ruby/webrick
  #
  require "webrick"

  ##
  # - https://ruby-doc.org/stdlib-2.7.0/libdoc/uri/rdoc/URI.html
  # - https://github.com/ruby/uri
  #
  require "uri"

  require_relative ::File.join("examples", "standard", version, "cowsay")
  require_relative ::File.join("examples", "standard", version, "date_time")
  require_relative ::File.join("examples", "standard", version, "factorial")
  require_relative ::File.join("examples", "standard", version, "gemfile")
  require_relative ::File.join("examples", "standard", version, "request_params")
  require_relative ::File.join("examples", "standard", version, "comprehensive_suite") if version.empty?
end

.require_test_toolsBoolean

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:

Expected to be called from ‘spec_helper.rb`.

Returns:

  • (Boolean)


267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# File 'lib/convenient_service/dependencies.rb', line 267

def require_test_tools
  ##
  # - https://github.com/faker-ruby/faker
  #
  require "faker"

  ##
  # - https://ruby-doc.org/stdlib-2.7.0/libdoc/ostruct/rdoc/OpenStruct.html
  # - https://github.com/ruby/ostruct
  #
  require "ostruct"

  ##
  # - https://ruby-doc.org/stdlib-2.7.0/libdoc/tempfile/rdoc/Tempfile.html
  # - https://github.com/ruby/tempfile
  #
  require "tempfile"
end

.require_wraps_result_in_db_transactionBoolean

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:

Expected to be called from app entry points like ‘initializers` in Rails.

Returns:

  • (Boolean)


183
184
185
186
187
188
189
190
191
192
# File 'lib/convenient_service/dependencies.rb', line 183

def require_wraps_result_in_db_transaction
  ##
  # - https://edgeguides.rubyonrails.org/active_record_basics.html
  # - https://api.rubyonrails.org/classes/ActiveRecord.html
  # - https://github.com/rails/rails/tree/main/activerecord
  #
  require "active_record"

  require_relative "service/plugins/wraps_result_in_db_transaction"
end

.rspecConvenientService::Support::RSpec

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.

Returns:

  • (ConvenientService::Support::RSpec)


421
422
423
# File 'lib/convenient_service/dependencies.rb', line 421

def rspec
  Support::Gems::RSpec
end

.rubyConvenientService::Support::Ruby

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.



412
413
414
# File 'lib/convenient_service/dependencies.rb', line 412

def ruby
  Support::Ruby
end

.support_has_j_send_result_params_validations_using_active_model_validations?Boolean

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.



21
22
23
24
25
26
# File 'lib/convenient_service/dependencies.rb', line 21

def support_has_j_send_result_params_validations_using_active_model_validations?
  return false unless active_model.loaded?
  return false if ruby.version >= 3.0 && active_model.version < 6.0

  true
end

.support_logger_non_integer_levels?Boolean

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.



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

def support_logger_non_integer_levels?
  logger.version >= "1.3.0"
end