denis (owner)

Revisions

gist: 197861 Download_button fork
public
Public Clone URL: git://gist.github.com/197861.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# 0: false
# 1: 0
# 2: true
# 3: 1
# 4: nil
# 5: 2
# ...
# 338: :"!"
# 378: :%
# 388: :&
# 428: :*
# 438: :+
# 458: :-
# 478: :/
 
(0..20_000).to_a.each do |id|
  begin
    object = ObjectSpace._id2ref(id)
    puts "#{id}: #{object.inspect}" unless object.is_a? Fixnum
  rescue RangeError
  end
end
 
# >> :"!".object_id
# => 338
# >> :"!".to_i
# => 33
# >> :%.object_id
# => 378
# >> :%.to_i
# => 37