Class: Formulary::QHPPlanRepo

Inherits:
Object
  • Object
show all
Defined in:
lib/formulary/qhp_plan_repo.rb

Overview

Simple in-memory storage for instances of QHPPlan

Class Method Summary collapse

Class Method Details

.allObject



18
19
20
# File 'lib/formulary/qhp_plan_repo.rb', line 18

def self.all
  repo
end

.idsObject



22
23
24
# File 'lib/formulary/qhp_plan_repo.rb', line 22

def self.ids
  repo.map(&:id)
end

.import(raw_qhp_plans) ⇒ Object



12
13
14
15
16
# File 'lib/formulary/qhp_plan_repo.rb', line 12

def self.import(raw_qhp_plans)
  raw_qhp_plans.each do |raw_plan|
    repo << QHPPlan.new(raw_plan)
  end
end

.repoObject



8
9
10
# File 'lib/formulary/qhp_plan_repo.rb', line 8

def self.repo
  @repo ||= reset!
end

.reset!Object



26
27
28
# File 'lib/formulary/qhp_plan_repo.rb', line 26

def self.reset!
  @repo = []
end