Class: FHIR::Field

Inherits:
Object
  • Object
show all
Includes:
Hashable
Defined in:
lib/fhir_models/bootstrap/field.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Hashable

#from_hash, #to_hash

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

#bindingObject

Returns the value of attribute binding.



13
14
15
# File 'lib/fhir_models/bootstrap/field.rb', line 13

def binding
  @binding
end

#constraintObject

Returns the value of attribute constraint.



15
16
17
# File 'lib/fhir_models/bootstrap/field.rb', line 15

def constraint
  @constraint
end

#local_nameObject

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

#maxObject

Returns the value of attribute max.



11
12
13
# File 'lib/fhir_models/bootstrap/field.rb', line 11

def max
  @max
end

#minObject

Returns the value of attribute min.



10
11
12
# File 'lib/fhir_models/bootstrap/field.rb', line 10

def min
  @min
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/fhir_models/bootstrap/field.rb', line 5

def name
  @name
end

#pathObject

Returns the value of attribute path.



7
8
9
# File 'lib/fhir_models/bootstrap/field.rb', line 7

def path
  @path
end

#regexObject

Returns the value of attribute regex.



14
15
16
# File 'lib/fhir_models/bootstrap/field.rb', line 14

def regex
  @regex
end

#typeObject

Returns the value of attribute type.



8
9
10
# File 'lib/fhir_models/bootstrap/field.rb', line 8

def type
  @type
end

#type_profilesObject

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_codesObject

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 %w[class method resourceType].include?(name)
  fix
end

#serializeObject



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..-1]] = instance_variable_get(v)
  end
  hash.delete('name')
  prune(hash)
end