-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
Date.today.compare_with_coercion nil or Date.today <=> nil sets the ruby global variable $! to #<NoMethodError: undefined method coerce for nil:NilClass>. It does not throw the exception but sets the global $! variable. Now when I raise the exception in my app code the raised exception's cause is set to #<NoMethodError: undefined method coerce' for nil:NilClass>`.
Environment Information
- JRuby version - jruby-9.2.13.0
- Operating system - MaC OS Catalina
- Rails - 6.0.3.2
Expected Behavior
- Raise the exception
#<NoMethodError: undefined method coerce for nil:NilClass>rather than just setting it in$!
Actual Behavior
- Sets the ruby's
$!variable to#<NoMethodError: undefined method coerce for nil:NilClass>but does not raises it.
Script
require 'rubygems'
require 'active_support'
require "date"
puts 'Before $! => '
puts $!
Date.today <=> nil
puts 'After $! => '
puts $!
Script Output :
Before $! =>
After $! =>
undefined method `coerce' for nil:NilClass
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels