Class: Formulary::QHPDrug

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

Overview

A drug as represented in QHP data

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_data) ⇒ QHPDrug

Returns a new instance of QHPDrug.



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

def initialize(raw_data)
  @raw_data = raw_data.freeze
end

Instance Attribute Details

#raw_dataObject (readonly)

Returns the value of attribute raw_data.



6
7
8
# File 'lib/formulary/qhp_drug.rb', line 6

def raw_data
  @raw_data
end

Instance Method Details

#in_plan?(plan_id) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/formulary/qhp_drug.rb', line 24

def in_plan?(plan_id)
  plans.any? { |plan| plan[:plan_id] == plan_id }
end

#nameObject



16
17
18
# File 'lib/formulary/qhp_drug.rb', line 16

def name
  raw_data[:drug_name]
end

#plansObject



20
21
22
# File 'lib/formulary/qhp_drug.rb', line 20

def plans
  raw_data[:plans]
end

#rxnorm_codeObject



12
13
14
# File 'lib/formulary/qhp_drug.rb', line 12

def rxnorm_code
  raw_data[:rxnorm_id]
end