Tbpgr Blog

Employee Experience Engineer tbpgr(てぃーびー) のブログ

Ruby | Integer

概要

Integer

詳細

整数の抽象クラス。整数は数値の大きさによってFixnumかBignumになるが
Integerはその基底クラスとなる。

サンプルコード

継承階層を確認します。

# encoding: utf-8
require 'tbpgr_utils'
require 'test_toolbox'

puts 1.class.aa_ancestors
dp_line __LINE__
puts (2<<29).class.aa_ancestors
__END__
下記はTbpgrUtils gemの機能
aa_ancestors
dp_line

https://rubygems.org/gems/tbpgr_utils
https://github.com/tbpgr/tbpgr_utils
出力
-------------
|BasicObject|
-------------
     |
-------------
|  Kernel   |
-------------
     |
-------------
|  Object   |
-------------
     |
-------------
|Comparable |
-------------
     |
-------------
|  Numeric  |
-------------
     |
-------------
|  Integer  |
-------------
     |
-------------
|  Fixnum   |
-------------
--------------------|filename=|line=6|--------------------
-------------
|BasicObject|
-------------
     |
-------------
|  Kernel   |
-------------
     |
-------------
|  Object   |
-------------
     |
-------------
|Comparable |
-------------
     |
-------------
|  Numeric  |
-------------
     |
-------------
|  Integer  |
-------------
     |
-------------
|  Bignum   |
-------------