Module: Byebug::DAP::Scalar Private

Defined in:
lib/byebug/dap/helpers/scalar.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Used in case statements to identify scalar types.

Instance Method Summary collapse

Instance Method Details

#===(value) ⇒ 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.

Match scalar values. nil, true, false, strings, numbers, times, ranges, dates, and date-times are considered scalars.

Returns:

  • (Boolean)


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/byebug/dap/helpers/scalar.rb', line 10

def ===(value)
  case value
  when nil, true, false
    return true
  when ::String, ::Symbol, ::Numeric
    return true
  when ::Time, ::Range
    true
  end

  return true if defined?(::Date) && ::Date === value
  return true if defined?(::DateTime) && ::DateTime === value

  false
end