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.
-
#null_flavor ⇒ Object
readonly
Returns the value of attribute null_flavor.
-
#original_text ⇒ Object
readonly
Returns the value of attribute original_text.
-
#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_null_flavor(null_flavor, original_text = 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, null_flavor = nil, original_text = 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, null_flavor = nil, original_text = nil) ⇒ Coded
Create a new HQMF::Coded
163 164 165 166 167 168 169 170 171 |
# File 'lib/hqmf-model/types.rb', line 163 def initialize(type,system,code,code_list_id=nil,title=nil,null_flavor=nil,original_text=nil) @type = type @system = system @code = code @code_list_id = code_list_id @title = title @null_flavor = null_flavor @original_text = original_text end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
157 158 159 |
# File 'lib/hqmf-model/types.rb', line 157 def code @code end |
#code_list_id ⇒ Object (readonly)
Returns the value of attribute code_list_id.
157 158 159 |
# File 'lib/hqmf-model/types.rb', line 157 def code_list_id @code_list_id end |
#null_flavor ⇒ Object (readonly)
Returns the value of attribute null_flavor.
157 158 159 |
# File 'lib/hqmf-model/types.rb', line 157 def null_flavor @null_flavor end |
#original_text ⇒ Object (readonly)
Returns the value of attribute original_text.
157 158 159 |
# File 'lib/hqmf-model/types.rb', line 157 def original_text @original_text end |
#system ⇒ Object (readonly)
Returns the value of attribute system.
157 158 159 |
# File 'lib/hqmf-model/types.rb', line 157 def system @system end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
157 158 159 |
# File 'lib/hqmf-model/types.rb', line 157 def title @title end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
157 158 159 |
# File 'lib/hqmf-model/types.rb', line 157 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_null_flavor(null_flavor, original_text = nil) ⇒ Object
181 182 183 |
# File 'lib/hqmf-model/types.rb', line 181 def self.for_null_flavor(null_flavor,original_text=nil) HQMF::Coded.new('CD',nil,nil,nil,nil,null_flavor,original_text) 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
185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/hqmf-model/types.rb', line 185 def self.from_json(json) json = json.with_indifferent_access 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"] null_flavor = json["null_flavor"] if json["null_flavor"] original_text = json["original_text"] if json["original_text"] HQMF::Coded.new(type,system,code,code_list_id,title, null_flavor, original_text) end |
Instance Method Details
#==(other) ⇒ Object
214 215 216 |
# File 'lib/hqmf-model/types.rb', line 214 def ==(other) check_equality(self,other) end |
#derived? ⇒ Boolean
206 207 208 |
# File 'lib/hqmf-model/types.rb', line 206 def derived? false end |
#to_json ⇒ Object
198 199 200 |
# File 'lib/hqmf-model/types.rb', line 198 def to_json build_hash(self, [:type,:system,:code,:code_list_id,:title,:null_flavor,:original_text]) end |
#unit ⇒ Object
210 211 212 |
# File 'lib/hqmf-model/types.rb', line 210 def unit nil end |
#value ⇒ Object
202 203 204 |
# File 'lib/hqmf-model/types.rb', line 202 def value code end |