Module: Everythingrb

Defined in:
lib/everythingrb/prelude.rb,
lib/railtie.rb,
lib/everythingrb/version.rb,
lib/everythingrb/extensions/quotable.rb

Overview

Extensions for making objects quotable with double quotes

These modules add the ability to quote objects by wrapping their string representations in double quotes. This is useful for generating error messages, debug output, or formatted logs where you want to clearly distinguish between different value types.

Examples:

Basic usage with different types

1.in_quotes                   # => "\"1\""
nil.in_quotes                 # => "\"nil\""
"hello".in_quotes             # => "\"\\\"hello\\\"\""
[1, 2, 3].in_quotes           # => "\"[1, 2, 3]\""

Using with collections

values = [1, nil, "hello"]
values.map(&:in_quotes)       # => ["\"1\"", "\"nil\"", "\"\\\"hello\\\"\""]

Error messages

expected = 42
actual = nil
raise "Expected #{expected.in_quotes} but got #{actual.in_quotes}"
# => "Expected \"42\" but got \"nil\""

Defined Under Namespace

Modules: InspectQuotable, StringQuotable Classes: Railtie

Constant Summary collapse

VERSION =

Current version of the everythingrb gem

"0.9.0"

Class Method Summary collapse

Class Method Details

.deprecatorObject

Since:

  • 0.1.0



28
29
30
31
32
33
34
35
36
# File 'lib/everythingrb/prelude.rb', line 28

def self.deprecator
  @deprecator ||= if defined?(ActiveSupport)
    ActiveSupport::Deprecation.new(VERSION, "everythingrb")
  else
    proxy = Data.define
    proxy.define_method(:warn) { |message| puts "DEPRECATION WARNING: #{message}" }
    proxy.new
  end
end