Class: HQMF::Coded
- Inherits:
-
Object
- Object
- HQMF::Coded
- Includes:
- HQMF::Conversion::Utilities
- Defined in:
- lib/hqmf-model/types.rb
Overview
Represents a HQMF CD value which has a code and codeSystem
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#code_list_id ⇒ Object
readonly
Returns the value of attribute code_list_id.
-
#system ⇒ Object
readonly
Returns the value of attribute system.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
- .for_code_list(code_list_id, title = nil) ⇒ Object
- .for_single_code(system, code, title = nil) ⇒ Object
- .from_json(json) ⇒ Object
Instance Method Summary collapse
- #==(other) ⇒ Object
- #derived? ⇒ Boolean
-
#initialize(type, system, code, code_list_id = nil, title = nil) ⇒ Coded
constructor
Create a new HQMF::Coded.
- #to_json ⇒ Object
- #unit ⇒ Object
- #value ⇒ Object
Methods included from HQMF::Conversion::Utilities
#build_hash, #check_equality, #json_array, #openstruct_to_json
Constructor Details
#initialize(type, system, code, code_list_id = nil, title = nil) ⇒ Coded
Create a new HQMF::Coded
165 166 167 168 169 170 171 |
# File 'lib/hqmf-model/types.rb', line 165 def initialize(type,system,code,code_list_id=nil,title=nil) @type = type @system = system @code = code @code_list_id = code_list_id @title = title end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
158 159 160 |
# File 'lib/hqmf-model/types.rb', line 158 def code @code end |
#code_list_id ⇒ Object (readonly)
Returns the value of attribute code_list_id.
158 159 160 |
# File 'lib/hqmf-model/types.rb', line 158 def code_list_id @code_list_id end |
#system ⇒ Object (readonly)
Returns the value of attribute system.
158 159 160 |
# File 'lib/hqmf-model/types.rb', line 158 def system @system end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
158 159 160 |
# File 'lib/hqmf-model/types.rb', line 158 def title @title end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
158 159 160 |
# File 'lib/hqmf-model/types.rb', line 158 def type @type end |
Class Method Details
.for_code_list(code_list_id, title = nil) ⇒ Object
173 174 175 |
# File 'lib/hqmf-model/types.rb', line 173 def self.for_code_list(code_list_id,title=nil) HQMF::Coded.new('CD',nil,nil,code_list_id,title) end |
.for_single_code(system, code, title = nil) ⇒ Object
177 178 179 |
# File 'lib/hqmf-model/types.rb', line 177 def self.for_single_code(system,code,title=nil) HQMF::Coded.new('CD',system,code,nil,title) end |
.from_json(json) ⇒ Object
181 182 183 184 185 186 187 188 189 |
# File 'lib/hqmf-model/types.rb', line 181 def self.from_json(json) type = json["type"] if json["type"] system = json["system"] if json["system"] code = json["code"] if json["code"] code_list_id = json["code_list_id"] if json["code_list_id"] title = json["title"] if json["title"] HQMF::Coded.new(type,system,code,code_list_id,title) end |
Instance Method Details
#==(other) ⇒ Object
207 208 209 |
# File 'lib/hqmf-model/types.rb', line 207 def ==(other) check_equality(self,other) end |
#derived? ⇒ Boolean
199 200 201 |
# File 'lib/hqmf-model/types.rb', line 199 def derived? false end |
#to_json ⇒ Object
191 192 193 |
# File 'lib/hqmf-model/types.rb', line 191 def to_json build_hash(self, [:type,:system,:code,:code_list_id,:title]) end |
#unit ⇒ Object
203 204 205 |
# File 'lib/hqmf-model/types.rb', line 203 def unit nil end |
#value ⇒ Object
195 196 197 |
# File 'lib/hqmf-model/types.rb', line 195 def value code end |