Class: Formulary::QHPDrug
- Inherits:
-
Object
- Object
- Formulary::QHPDrug
- Defined in:
- lib/formulary/qhp_drug.rb
Overview
A drug as represented in QHP data
Instance Attribute Summary collapse
-
#raw_data ⇒ Object
readonly
Returns the value of attribute raw_data.
Instance Method Summary collapse
- #in_plan?(plan_id) ⇒ Boolean
-
#initialize(raw_data) ⇒ QHPDrug
constructor
A new instance of QHPDrug.
- #name ⇒ Object
- #plans ⇒ Object
- #rxnorm_code ⇒ Object
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_data ⇒ Object (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
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 |
#name ⇒ Object
16 17 18 |
# File 'lib/formulary/qhp_drug.rb', line 16 def name raw_data[:drug_name] end |
#plans ⇒ Object
20 21 22 |
# File 'lib/formulary/qhp_drug.rb', line 20 def plans raw_data[:plans] end |
#rxnorm_code ⇒ Object
12 13 14 |
# File 'lib/formulary/qhp_drug.rb', line 12 def rxnorm_code raw_data[:rxnorm_id] end |