Sha256: be070c53359a07caeeb492c0b0f3e0956b68b62394b89ee68640ab38bdb8aeff

Contents?: true

Size: 1.39 KB

Versions: 2

Compression:

Stored size: 1.39 KB

Contents

# frozen_string_literal: true

##
# @api private
#
# Defines `ds` helper in order to have a quick way to find differences between strings like `git diff`.
#
# @param first_string [String]
# @param second_string [String]
# @return [nil]
#
# @note `ds' is a dev-only helper.
# @note `ds` is a short for `diff_strings`.
#
# @example
#   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.
#
def ds(first_string, second_string)
  require "diffy"

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
convenient_service-0.19.1 lib/convenient_service/dependencies/extractions/ds.rb
convenient_service-0.19.0 lib/convenient_service/dependencies/extractions/ds.rb