Created
May 26, 2010 01:02
-
-
Save weatheredwatcher/413912 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@contentsArray=[] #first we initialize an array for the contents | |
@fileArray =[] #then we initialize an array for the files | |
Dir.foreach("#{RAILS_ROOT}/public/posts") do |fname| | |
next if fname == '.' or fname == '..' | |
@fileArray.push fname | |
end | |
@fileArray = @fileArray.reverse #this insures that the blogs entries are listed in descending order | |
@fileArray.each{|file| | |
f = File.open("#{RAILS_ROOT}/public/posts/" + file, 'r') | |
f.each_line {|line| | |
@contentsArray.push line | |
}} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment