Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @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
- }}
Add Comment
Please, Sign In to add comment