lib/ayadn/databases.rb in ayadn-1.7.7 vs lib/ayadn/databases.rb in ayadn-1.8.0

- old
+ new

@@ -2,11 +2,11 @@ module Ayadn class Databases class << self - attr_accessor :users, :index, :pagination, :aliases, :blacklist, :bookmarks, :nicerank + attr_accessor :users, :index, :pagination, :aliases, :blacklist, :bookmarks, :nicerank, :channels end def self.open_databases if Settings.options[:timeline][:show_debug] == true puts "\n-Opening databases-\n" @@ -16,17 +16,18 @@ @pagination = self.init "#{Settings.config[:paths][:pagination]}/pagination.db" @aliases = self.init "#{Settings.config[:paths][:db]}/aliases.db" @blacklist = self.init "#{Settings.config[:paths][:db]}/blacklist.db" @bookmarks = self.init "#{Settings.config[:paths][:db]}/bookmarks.db" @nicerank = self.init "#{Settings.config[:paths][:db]}/nicerank.db" + @channels = self.init "#{Settings.config[:paths][:db]}/channels.db" if Settings.options[:timeline][:show_debug] == true puts "\n-Done-\n" end end def self.all_dbs - [@users, @index, @pagination, @aliases, @blacklist, @bookmarks, @nicerank] + [@users, @index, @pagination, @aliases, @blacklist, @bookmarks, @nicerank, @channels] end def self.close_all if @nicerank.size > 5000 @@ -172,9 +173,17 @@ @bookmarks.delete post_id end def self.rename_bookmark post_id, new_title @bookmarks[post_id][:title] = new_title + end + + def self.add_channel_object channel + @channels[channel['id']] = channel + end + + def self.remove_channel channel_id + @channels.delete channel_id end end end