Sha256: f6b4bcd3f2f0d81e63d4c52a0beb929f167ebcfe6f64d17b3b3172c693740671

Contents?: true

Size: 825 Bytes

Versions: 9

Compression:

Stored size: 825 Bytes

Contents

module FHIR
  class Field
    include FHIR::Hashable

    attr_accessor :name
    attr_accessor :local_name
    attr_accessor :path
    attr_accessor :type
    attr_accessor :type_profiles
    attr_accessor :min
    attr_accessor :max
    attr_accessor :valid_codes
    attr_accessor :binding
    attr_accessor :regex
    attr_accessor :constraint

    def initialize(name = '')
      @name = name
      @local_name = fix_name(@name)
      @type_profiles = []
      @valid_codes = []
    end

    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

    def fix_name(name)
      fix = nil
      fix = "local_#{name}" if %w[class method resourceType].include?(name)
      fix
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
fhir_models-4.2.2 lib/fhir_models/bootstrap/field.rb
fhir_models-4.2.1 lib/fhir_models/bootstrap/field.rb
fhir_models-4.2.0 lib/fhir_models/bootstrap/field.rb
fhir_models-4.1.2 lib/fhir_models/bootstrap/field.rb
fhir_models-4.1.1 lib/fhir_models/bootstrap/field.rb
fhir_models-4.1.0 lib/fhir_models/bootstrap/field.rb
fhir_models-4.0.2 lib/fhir_models/bootstrap/field.rb
fhir_models-4.0.1 lib/fhir_models/bootstrap/field.rb
fhir_models-4.0.0 lib/fhir_models/bootstrap/field.rb