Class: FHIR::Field
- Inherits:
-
Object
- Object
- FHIR::Field
- Includes:
- Hashable
- Defined in:
- lib/fhir_models/bootstrap/field.rb
Instance Attribute Summary collapse
-
#binding ⇒ Object
Returns the value of attribute binding.
-
#constraint ⇒ Object
Returns the value of attribute constraint.
-
#local_name ⇒ Object
Returns the value of attribute local_name.
-
#max ⇒ Object
Returns the value of attribute max.
-
#min ⇒ Object
Returns the value of attribute min.
-
#name ⇒ Object
Returns the value of attribute name.
-
#path ⇒ Object
Returns the value of attribute path.
-
#regex ⇒ Object
Returns the value of attribute regex.
-
#type ⇒ Object
Returns the value of attribute type.
-
#type_profiles ⇒ Object
Returns the value of attribute type_profiles.
-
#valid_codes ⇒ Object
Returns the value of attribute valid_codes.
Instance Method Summary collapse
- #fix_name(name) ⇒ Object
-
#initialize(name = '') ⇒ Field
constructor
A new instance of Field.
- #serialize ⇒ Object
Methods included from Hashable
Constructor Details
#initialize(name = '') ⇒ Field
Returns a new instance of Field.
17 18 19 20 21 22 |
# File 'lib/fhir_models/bootstrap/field.rb', line 17 def initialize(name = '') @name = name @local_name = fix_name(@name) @type_profiles = [] @valid_codes = [] end |
Instance Attribute Details
#binding ⇒ Object
Returns the value of attribute binding.
13 14 15 |
# File 'lib/fhir_models/bootstrap/field.rb', line 13 def binding @binding end |
#constraint ⇒ Object
Returns the value of attribute constraint.
15 16 17 |
# File 'lib/fhir_models/bootstrap/field.rb', line 15 def constraint @constraint end |
#local_name ⇒ Object
Returns the value of attribute local_name.
6 7 8 |
# File 'lib/fhir_models/bootstrap/field.rb', line 6 def local_name @local_name end |
#max ⇒ Object
Returns the value of attribute max.
11 12 13 |
# File 'lib/fhir_models/bootstrap/field.rb', line 11 def max @max end |
#min ⇒ Object
Returns the value of attribute min.
10 11 12 |
# File 'lib/fhir_models/bootstrap/field.rb', line 10 def min @min end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/fhir_models/bootstrap/field.rb', line 5 def name @name end |
#path ⇒ Object
Returns the value of attribute path.
7 8 9 |
# File 'lib/fhir_models/bootstrap/field.rb', line 7 def path @path end |
#regex ⇒ Object
Returns the value of attribute regex.
14 15 16 |
# File 'lib/fhir_models/bootstrap/field.rb', line 14 def regex @regex end |
#type ⇒ Object
Returns the value of attribute type.
8 9 10 |
# File 'lib/fhir_models/bootstrap/field.rb', line 8 def type @type end |
#type_profiles ⇒ Object
Returns the value of attribute type_profiles.
9 10 11 |
# File 'lib/fhir_models/bootstrap/field.rb', line 9 def type_profiles @type_profiles end |
#valid_codes ⇒ Object
Returns the value of attribute valid_codes.
12 13 14 |
# File 'lib/fhir_models/bootstrap/field.rb', line 12 def valid_codes @valid_codes end |
Instance Method Details
#fix_name(name) ⇒ Object
33 34 35 36 37 |
# File 'lib/fhir_models/bootstrap/field.rb', line 33 def fix_name(name) fix = nil fix = "local_#{name}" if ['class', 'method', 'resourceType'].include?(name) fix end |
#serialize ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/fhir_models/bootstrap/field.rb', line 24 def serialize hash = {} instance_variables.each do |v| hash[v.to_s[1..]] = instance_variable_get(v) end hash.delete('name') prune(hash) end |