Ruby irb Notes

From PeformIQ Upgrade
Revision as of 10:56, 18 March 2010 by PeterHarding (talk | contribs) (Created page with '=Notes= http://www.tutorialspoint.com/ruby/ruby_input_output.htm ==Dir== <pre> d = Dir.new('C:\TEMP') d.each {|n| puts n } d.each {|n| puts n if n=~/py$/ } d.each {|n| put...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Notes

http://www.tutorialspoint.com/ruby/ruby_input_output.htm

Dir

 d = Dir.new('C:\TEMP')
 d.each {|n| puts n }
 d.each {|n| puts n if n=~/py$/ }
 d.each {|n| puts n if d=~/txt$/ }

File

irb(main):048:0> File.exists? dd.entries[0]
=> true
File.ftype  dd.entries[2]
=> "file"
irb(main):047:0> File.directory?  dd.entries[2]
=> false
irb(main):048:0>