開発環境
- OS X Lion - Apple(OS)
- TextWrangler(Text Editor) (BBEditの機能制限無料版、light版)
- Script言語:Ruby
『Learning Ruby』(Michael Fitzgerald 著、O'Reilly Media、2007年、ISBN978-0-596-52986-4)の Chapter 5(Math)Review Questions 2を解いてみる。
その他参考書籍
- 『プログラミング言語 Ruby』David Flanagan, まつもと ゆきひろ 著 、卜部 昌平 監訳、長尾 高弘 訳、オライリー・ジャパン、2009年、ISBN978-4-87311-394-4)
2.
included_modules
コード(TextWrangler)
#!/usr/bin/env ruby # -*- coding: utf-8 -*- [Numeric,Object,String,Integer,Array].each do |c| print "#{c}: " c.included_modules.each do |m| print "#{m} " end print "\n" end
入出力結果(Terminal)
$ ./sample.rb Numeric: Comparable Kernel Object: Kernel String: Enumerable Comparable Kernel Integer: Precision Comparable Kernel Array: Enumerable Kernel $
0 コメント:
コメントを投稿