Mercurial > repos > other > SevenLanguagesInSevenWeeks
annotate 1-Ruby/object-all-things-2.rb @ 6:a50d2fac49ce
Add some experiments of what different objects are and what functions they have
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Mon, 02 Jan 2017 20:45:34 +0000 |
parents | |
children | b8f4577db289 |
rev | line source |
---|---|
6
a50d2fac49ce
Add some experiments of what different objects are and what functions they have
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
1 #! /usr/bin/env ruby |
a50d2fac49ce
Add some experiments of what different objects are and what functions they have
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
2 |
a50d2fac49ce
Add some experiments of what different objects are and what functions they have
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
3 objects = [ 4, 3.14, 'Pi', 'π'] |
a50d2fac49ce
Add some experiments of what different objects are and what functions they have
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
4 objects.each { |obj| |
a50d2fac49ce
Add some experiments of what different objects are and what functions they have
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
5 puts "#{obj} (#{obj.class})" |
a50d2fac49ce
Add some experiments of what different objects are and what functions they have
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
6 obj.methods.each { |method| puts " #{method}" } |
a50d2fac49ce
Add some experiments of what different objects are and what functions they have
IBBoard <dev@ibboard.co.uk>
parents:
diff
changeset
|
7 } |