Module: Trailblazer::Core::Utils

Defined in:
lib/trailblazer/core/utils.rb,
lib/trailblazer/core/utils/inspect.rb,
lib/trailblazer/core/utils/version.rb,
lib/trailblazer/core/utils/symbol_inspect_for.rb,
lib/trailblazer/core/utils/convert_operation_test.rb

Defined Under Namespace

Modules: ConvertOperationTest, Inspect Classes: Error

Constant Summary collapse

VERSION =
"0.0.4"

Class Method Summary collapse

Class Method Details

.inspect(object) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/trailblazer/core/utils/inspect.rb', line 4

def self.inspect(object)
  return Inspect.convert_hash_inspect(object) if object.is_a?(String)
  return object.inspect unless object.is_a?(Hash)

  old_string = object.inspect

  Inspect.convert_hash_inspect(old_string)
end

.symbol_inspect_for(name) ⇒ Object

Used to test keyword exceptions in all Ruby versions.



5
6
7
8
9
10
11
# File 'lib/trailblazer/core/utils/symbol_inspect_for.rb', line 5

def self.symbol_inspect_for(name)
  if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.7.0") || RUBY_ENGINE == 'jruby'
    "#{name}"
  else
    ":#{name}"
  end
end