Class: AlleJest::Filter
- Inherits:
-
Object
- Object
- AlleJest::Filter
- Includes:
- HasAttributes
- Defined in:
- lib/allejest.rb
Instance Attribute Summary collapse
-
#filter_db ⇒ Object
Returns the value of attribute filter_db.
-
#filter_db_path ⇒ Object
Returns the value of attribute filter_db_path.
Instance Method Summary collapse
- #close ⇒ Object
- #filter(results) ⇒ Object
-
#initialize(args = {}) ⇒ Filter
constructor
A new instance of Filter.
- #old_initialize ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Filter
Returns a new instance of Filter.
139 140 141 142 |
# File 'lib/allejest.rb', line 139 def initialize(args = {}) old_initialize(args) read_db end |
Instance Attribute Details
#filter_db ⇒ Object
Returns the value of attribute filter_db.
135 136 137 |
# File 'lib/allejest.rb', line 135 def filter_db @filter_db end |
#filter_db_path ⇒ Object
Returns the value of attribute filter_db_path.
135 136 137 |
# File 'lib/allejest.rb', line 135 def filter_db_path @filter_db_path end |
Instance Method Details
#close ⇒ Object
161 162 163 164 |
# File 'lib/allejest.rb', line 161 def close prune save_db end |
#filter(results) ⇒ Object
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/allejest.rb', line 144 def filter results now = Time.now.to_i results.dup.each do |result| result.items.reject! do |item| id = item.id unless id.blank? r = filter_db[:reported].has_key? id filter_db[:reported][id] = {:first_seen => now} unless r r else true end end end end |
#old_initialize ⇒ Object
137 |
# File 'lib/allejest.rb', line 137 alias_method :old_initialize, :initialize |