Sha256: 0c362cc3df4604b46b6ee15c840d9aa6c2d6555e8580bed5264107b3ef6c97b6

Contents?: true

Size: 757 Bytes

Versions: 1

Compression:

Stored size: 757 Bytes

Contents

module Byebug::DAP
  # Used in case statements to identify scalar types.
  # @api private
  module Scalar
    # Match scalar values. {std:NilClass nil}, {std:TrueClass true},
    # {std:FalseClass false}, {std:String strings}, {std:Numeric numbers},
    # {std:Time times}, {std:Range ranges}, {std:date:Date dates}, and
    # {std:date:DateTime date-times} are considered scalars.
    # @return [Boolean]
    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
byebug-dap-0.1.4 lib/byebug/dap/helpers/scalar.rb