Class: Quby::Answers::Repos::DiskRepo
- Defined in:
- lib/quby/answers/repos/disk_repo.rb
Defined Under Namespace
Classes: Record
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #find_completed_after(time, answer_ids) ⇒ Object
-
#initialize(path) ⇒ DiskRepo
constructor
A new instance of DiskRepo.
Methods inherited from Base
#all, #create!, #find, #reload, #update!
Constructor Details
#initialize(path) ⇒ DiskRepo
Returns a new instance of DiskRepo.
15 16 17 |
# File 'lib/quby/answers/repos/disk_repo.rb', line 15 def initialize(path) @path = Pathname.new(path). end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
13 14 15 |
# File 'lib/quby/answers/repos/disk_repo.rb', line 13 def path @path end |
Instance Method Details
#find_completed_after(time, answer_ids) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/quby/answers/repos/disk_repo.rb', line 19 def find_completed_after(time, answer_ids) records = storage.map { |filename| load_file(filename) }.select do |record| answer_ids.include?(record._id) && record.completed_at.present? && record.completed_at > time end records.map { |record| entity(record) } end |