Sha256: d6161298f0ff4ec631df2b7e28d01a4a686733798e122f60f2c89cc06e71a5e9

Contents?: true

Size: 505 Bytes

Versions: 9

Compression:

Stored size: 505 Bytes

Contents

# frozen_string_literal: true

# Reopen the core Symbol class to represent {#inspect_lit}.
class Symbol
  # Formats this symbol to look like a symbol literal so that object type will
  # be inherently obvious when used in logging methods, etc.
  #
  # @return [String] a symbol literal representation of this object
  #
  # @example
  #   :test.inspect_lit      # => ":\"test\"" (or ':"test"')
  #   :"ta-da!".inspect_lit  # => ":\"ta-da!\"" (or ':"ta-da!"')
  def inspect_lit
    %(:"#{self}")
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
object_identifier-0.8.0 lib/core_ext/symbol.rb
object_identifier-0.7.0 lib/core_ext/symbol.rb
object_identifier-0.6.0 lib/core_ext/symbol.rb
object_identifier-0.5.0 lib/core_ext/symbol.rb
object_identifier-0.4.1 lib/core_ext/symbol.rb
object_identifier-0.4.0 lib/core_ext/symbol.rb
object_identifier-0.3.0 lib/core_ext/symbol.rb
object_identifier-0.2.1 lib/core_ext/symbol.rb
object_identifier-0.2.0 lib/core_ext/symbol.rb