Sha256: f4be829291a423ecde6c0116ab04d9231aad6b1f605c641f99337438843278b1
Contents?: true
Size: 1.64 KB
Versions: 4
Compression:
Stored size: 1.64 KB
Contents
module Eddy module Models module Element # Identifier. Works with a code list specified by the dictionary. class ID < Base # @param min [Integer] # @param max [Integer] # @param req [String] (nil) # @param ref [String] (nil) # @param val [String] (nil) # @return [void] def initialize( min:, max:, req: nil, ref: nil, val: nil ) @type = "ID" @min = min @max = max self.req = req self.ref = ref self.value = val end # @param arg [String] # return [void] def value=(arg) if arg == :skip @val = :skip return end if arg.nil?() @val = arg return end raise Eddy::Errors::ElementValidationError.new("Value not present in code list: #{arg}", element: self) unless self.code_list().include?(arg) @val = arg end # @raise [Eddy::Errors::ElementNilValueError] If the element is required and no value has been set. # @return [String] def value() return super() end # @return [String] def process_value() return self.class.process_value(@val) end # @param val [String] Original value. # @return [String] def self.process_value(val) return val end # @return [Array<String>] def code_list() raise NotImplementedError, "Each ID element must define its own code_list" end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
eddy-0.10.0 | lib/eddy/models/element/id.rb |
eddy-0.9.2 | lib/eddy/models/element/id.rb |
eddy-0.9.1 | lib/eddy/models/element/id.rb |
eddy-0.9.0 | lib/eddy/models/element/id.rb |