Sha256: 64e0c54319a6d40e93554d2a43d60fac26db7d3823e943b14c3d535ade2b55a4

Contents?: true

Size: 1.2 KB

Versions: 3

Compression:

Stored size: 1.2 KB

Contents

---
layout: post
category: ruby
title: == 核心子类Override一览
---

## 引子

* 只检查类本身是否有Override,有些类的父类做了Override了的;
* Module/Symbol虽然有Override `==`方法,但是代码跟BasicObject的一样,可认为没有Override;
* Range 中的 `===`并不完全等于 `include?`, 参数处理上略有差异;

| Class/Module | Override `==` | Override `eql?` (Same as `==`) | Override `===` (Same as `==`) | 
|---|---|---|---|
| Array | √ | √(×)| × | 
| Hash | √ | √(√)| × | 
| Range | √ | √(×)| √(`include?`)|
| Comparable | √ | × | × |
| Exception | √ | × | × |
| Numeric | × | √ | x |
| Complex | √ | × | × |
| Float | √ | √(×)| √(√)|
| Integer | √ | × | √(√)| 
| Rational | √ | × | × |
| MatchData | √ | √(√) | × |
| Method | √ | √(√) | √(`call`)|
| Proc | x | x | √(`call`)|
| Module | × | × | × |
| Random | √ | × | × |
| Regexp | √ | √(√) | √(×)|
| String | √ | √(×) | √(√)|
| Struct | √ | √(×) | × |
| Symbol | x | x | x |
| FalseClass | x | x | √ |
| TrueClass | x | x | √ |
| NilClass | x | x | √ |

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rails_auth-1.0.6 test/dummy/node_modules/yougexiangfa_ui/_posts/ruby/2018-05-05-eql.md
rails_auth-1.0.5 test/dummy/node_modules/yougexiangfa_ui/_posts/ruby/2018-05-05-eql.md
rails_auth-1.0.4 test/dummy/node_modules/yougexiangfa_ui/_posts/ruby/2018-05-05-eql.md