Hatena::Groupruby

mrのRuby学習帳 このページをアンテナに追加 RSSフィード

2010-05-23

Dir.read Dir.read - mrのRuby学習帳 を含むブックマーク

irb(main):001:0> dir = Dir.open("./")
=> #<Dir:./>
irb(main):002:0> while filename = Dir.read
irb(main):003:1>   puts file_name
irb(main):004:1> end
NoMethodError: undefined method `read' for Dir:Class
        from (irb):2
        from :0

あれ?

irb(main):001:0> dir = Dir.open("./")
=> #<Dir:./>
irb(main):002:0> while file_name = dir.read
irb(main):003:1>   puts file_name
irb(main):004:1> end
.
..
test.rb
test2.txt
=> nil

これでいけるみたい。

AngelAngel2012/08/14 13:17That's an apt answer to an intreetsing question

ppvwdtvkppvwdtvk2012/08/14 23:35EqrHQ4 <a href="http://jqtolsytvcxz.com/">jqtolsytvcxz</a>

blguuijfblguuijf2012/08/15 04:09xLOn04 , [url=http://ehnebixjcnpq.com/]ehnebixjcnpq[/url], [link=http://bxwqyckkryvh.com/]bxwqyckkryvh[/link], http://lycmtsyvfkkm.com/

fnbajgqloefnbajgqloe2012/08/16 19:078XYCex , [url=http://oygkofasvwhi.com/]oygkofasvwhi[/url], [link=http://urmtguhjvjet.com/]urmtguhjvjet[/link], http://zujqwbfuvdla.com/