Class: Quby::Answers::Repos::DiskRepo

Inherits:
Base
  • Object
show all
Defined in:
lib/quby/answers/repos/disk_repo.rb

Defined Under Namespace

Classes: Record

Instance Attribute Summary collapse

Instance Method Summary collapse

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).expand_path
end

Instance Attribute Details

#pathObject (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