Module: ConvenientService::Dependencies::Queries

Extended by:
Queries
Included in:
ConvenientService::Dependencies, Queries
Defined in:
lib/convenient_service/dependencies/queries.rb,
lib/convenient_service/dependencies/queries/ruby.rb,
lib/convenient_service/dependencies/queries/version.rb,
lib/convenient_service/dependencies/queries/gems/paint.rb,
lib/convenient_service/dependencies/queries/gems/rspec.rb,
lib/convenient_service/dependencies/queries/gems/logger.rb,
lib/convenient_service/dependencies/queries/gems/active_model.rb,
lib/convenient_service/dependencies/queries/version/null_version.rb

Defined Under Namespace

Modules: Gems Classes: Ruby, Version

Instance Method Summary collapse

Instance Method Details

#active_modelConvenientService::Dependencies::Queries::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.



474
475
476
# File 'lib/convenient_service/dependencies/queries.rb', line 474

def active_model
  Gems::ActiveModel
end

#appraisal_nameString

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:

  • (String)


519
520
521
# File 'lib/convenient_service/dependencies/queries.rb', line 519

def appraisal_name
  ::ENV["APPRAISAL_NAME"].to_s
end

#appraisal_name_for_coverageString

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:

  • (String)


531
532
533
# File 'lib/convenient_service/dependencies/queries.rb', line 531

def appraisal_name_for_coverage
  appraisal_name.empty? ? "without_appraisal" : appraisal_name
end

#loggerConvenientService::Dependencies::Queries::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.



483
484
485
# File 'lib/convenient_service/dependencies/queries.rb', line 483

def logger
  Gems::Logger
end

#paintConvenientService::Dependencies::Queries::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.



492
493
494
# File 'lib/convenient_service/dependencies/queries.rb', line 492

def paint
  Gems::Paint
end

#require_aliasBoolean

Note:

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

Returns:

  • (Boolean)


56
57
58
# File 'lib/convenient_service/dependencies/queries.rb', line 56

def require_alias
  require "convenient_service/alias"
end

#require_amazing_print_inspectBoolean

Note:

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

Returns:

  • (Boolean)


126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/convenient_service/dependencies/queries.rb', line 126

def require_amazing_print_inspect
  ##
  # - https://github.com/amazing-print/amazing_print
  #
  require "amazing_print"

  require "convenient_service/service/plugins/has_amazing_print_inspect"
  require "convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_amazing_print_inspect"
  require "convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/plugins/has_amazing_print_inspect"
  require "convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/plugins/has_amazing_print_inspect"
  require "convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins/has_amazing_print_inspect"
  require "convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/plugins/has_amazing_print_inspect"
  require "convenient_service/service/plugins/can_have_steps/entities/step/plugins/has_amazing_print_inspect"
  require "convenient_service/service/configs/amazing_print_inspect"
  require "convenient_service/service/configs/amazing_print_inspect/aliases"
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)


66
67
68
69
70
71
72
73
74
75
# File 'lib/convenient_service/dependencies/queries.rb', line 66

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 "convenient_service/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)


83
84
85
86
87
88
89
90
91
# File 'lib/convenient_service/dependencies/queries.rb', line 83

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 "convenient_service/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)


149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'lib/convenient_service/dependencies/queries.rb', line 149

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

  require "convenient_service/service/plugins/has_awesome_print_inspect"
  require "convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_awesome_print_inspect"
  require "convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/data/plugins/has_awesome_print_inspect"
  require "convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/message/plugins/has_awesome_print_inspect"
  require "convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/status/plugins/has_awesome_print_inspect"
  require "convenient_service/service/plugins/has_j_send_result/entities/result/plugins/has_j_send_status_and_attributes/entities/code/plugins/has_awesome_print_inspect"
  require "convenient_service/service/plugins/can_have_steps/entities/step/plugins/has_awesome_print_inspect"
  require "convenient_service/service/configs/awesome_print_inspect"
  require "convenient_service/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)


99
100
101
# File 'lib/convenient_service/dependencies/queries.rb', line 99

def require_can_utilize_finite_loop
  require "convenient_service/common/plugins/can_utilize_finite_loop"
end

#require_development_tools(amazing_print: false, awesome_print: true) ⇒ 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.

Note:

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

Returns:

  • (Boolean)


239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'lib/convenient_service/dependencies/queries.rb', line 239

def require_development_tools(amazing_print: false, awesome_print: true)
  ##
  # - https://github.com/awesome-print/awesome_print
  #
  require "awesome_print" if awesome_print

  ##
  # - https://github.com/amazing-print/amazing_print
  #
  require "amazing_print" if amazing_print

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

  ##
  # - https://github.com/deivid-rodriguez/byebug
  #
  require "byebug" if ruby.mri?

  ##
  # - https://github.com/ruby/debug
  #
  require "debug" if ruby.mri?

  ##
  # - 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 "convenient_service/dependencies/extractions/byebug_syntax_highlighting" if ruby.mri?

  require "convenient_service/dependencies/extractions/b" if ruby.mri?

  ##
  #
  #
  require "convenient_service/dependencies/extractions/ce"

  ##
  #
  #
  require "convenient_service/dependencies/extractions/ds"
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)


430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
# File 'lib/convenient_service/dependencies/queries.rb', line 430

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 ::File.join("convenient_service", "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)


109
110
111
112
113
114
115
116
117
118
# File 'lib/convenient_service/dependencies/queries.rb', line 109

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 "convenient_service/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.



174
175
176
177
178
179
180
181
182
183
# File 'lib/convenient_service/dependencies/queries.rb', line 174

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 "convenient_service/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)


191
192
193
194
195
196
197
198
199
# File 'lib/convenient_service/dependencies/queries.rb', line 191

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 "convenient_service/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)


401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
# File 'lib/convenient_service/dependencies/queries.rb', line 401

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 ::File.join("convenient_service", "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)


207
208
209
# File 'lib/convenient_service/dependencies/queries.rb', line 207

def require_rescues_result_unhandled_exceptions
  require "convenient_service/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)


338
339
340
341
342
343
344
# File 'lib/convenient_service/dependencies/queries.rb', line 338

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

  require "convenient_service/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)


354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/convenient_service/dependencies/queries.rb', line 354

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 ::File.join("convenient_service", "examples", "standard", version, "cowsay")
  require ::File.join("convenient_service", "examples", "standard", version, "date_time")
  require ::File.join("convenient_service", "examples", "standard", version, "factorial")
  require ::File.join("convenient_service", "examples", "standard", version, "gemfile")
  require ::File.join("convenient_service", "examples", "standard", version, "request_params")
  require ::File.join("convenient_service", "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)


311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/convenient_service/dependencies/queries.rb', line 311

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)


217
218
219
220
221
222
223
224
225
226
# File 'lib/convenient_service/dependencies/queries.rb', line 217

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 "convenient_service/service/plugins/wraps_result_in_db_transaction"
end

#rspecConvenientService::Dependencies::Queries::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::Dependencies::Queries::RSpec)


465
466
467
# File 'lib/convenient_service/dependencies/queries.rb', line 465

def rspec
  Gems::RSpec
end

#rubyConvenientService::Dependencies::Queries::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.



456
457
458
# File 'lib/convenient_service/dependencies/queries.rb', line 456

def ruby
  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.

Returns:

  • (Boolean)

See Also:

  • ConvenientService.Dependencies.require_has_j_send_result_params_validations_using_active_model_validations


32
33
34
35
36
37
# File 'lib/convenient_service/dependencies/queries.rb', line 32

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.



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

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