Skip to content
  • Emily Dobervich's avatar
    4988d347
    Fixed problem where `1.day.eql?(1.day)` is false · 4988d347
    Emily Dobervich authored
    This fixes:
        1.second.eql?(1.second) #=> false
    
    The new `eql?` requires that `other` is an `ActiveSupport::Duration`.
    This requirement makes `ActiveSupport::Duration`'s behavior consistent
    with other numeric types in Ruby.
    
        1.eql?(1.0) #=> false
        1.0.eql?(1) #=> false
    
        1.second.eql?(1) #=> false (was true)
        1.eql?(1.second) #=> false
    
        { 1 => "foo", 1.0 => "bar" }
        #=> { 1 => "foo", 1.0 => "bar" }
    
        { 1 => "foo", 1.second => "bar" }
        # now => { 1 => "foo", 1.second => "bar" }
        # was => { 1 => "bar" }
    
    And though the behavior here hasn't changed, for reference:
    
        1 == 1.0 #=> true
        1.0 == 1 #=> true
    
        1 == 1.second #=> true
        1.second == 1 #=> true
    
    Conflicts:
    	activesupport/CHANGELOG.md
    4988d347
    Fixed problem where `1.day.eql?(1.day)` is false
    Emily Dobervich authored
    This fixes:
        1.second.eql?(1.second) #=> false
    
    The new `eql?` requires that `other` is an `ActiveSupport::Duration`.
    This requirement makes `ActiveSupport::Duration`'s behavior consistent
    with other numeric types in Ruby.
    
        1.eql?(1.0) #=> false
        1.0.eql?(1) #=> false
    
        1.second.eql?(1) #=> false (was true)
        1.eql?(1.second) #=> false
    
        { 1 => "foo", 1.0 => "bar" }
        #=> { 1 => "foo", 1.0 => "bar" }
    
        { 1 => "foo", 1.second => "bar" }
        # now => { 1 => "foo", 1.second => "bar" }
        # was => { 1 => "bar" }
    
    And though the behavior here hasn't changed, for reference:
    
        1 == 1.0 #=> true
        1.0 == 1 #=> true
    
        1 == 1.second #=> true
        1.second == 1 #=> true
    
    Conflicts:
    	activesupport/CHANGELOG.md
Loading