Class: Stupidedi::Versions::Common::ElementTypes::R

Inherits:
SimpleElementDef show all
Defined in:
lib/stupidedi/versions/common/element_types/r.rb

Instance Attribute Summary collapse

Attributes inherited from SimpleElementDef

#description, #id, #max_length, #min_length, #name, #parent

Attributes inherited from Schema::AbstractElementDef

#description, #id, #name

Instance Method Summary collapse

Methods inherited from SimpleElementDef

#empty, #value

Methods inherited from Schema::SimpleElementDef

#code_lists, #component_use, #composite?, #empty, #parent, #parse, #simple?, #simple_use, #value

Methods inherited from Schema::AbstractElementDef

#code_lists, #composite?, #descriptor, #element?, #simple?

Methods included from Inspect

#inspect

Methods inherited from Schema::AbstractDef

#component?, #composite?, #definition?, #descriptor, #element?, #functional_group?, #interchange?, #loop?, #repeated?, #required?, #segment?, #simple?, #table?, #transaction_set?, #usage?

Constructor Details

#initialize(id, name, min_length, max_length, max_precision = nil, description = nil, parent = nil) ⇒ R

Returns a new instance of R.



12
13
14
15
16
17
18
19
20
21
# File 'lib/stupidedi/versions/common/element_types/r.rb', line 12

def initialize(id, name, min_length, max_length, max_precision = nil, description = nil, parent = nil)
  super(id, name, min_length, max_length, description, parent)

  if max_precision.try(:>, max_length)
    raise Exceptions::InvalidSchemaError,
      "max_precision cannot be greater than max_length"
  end

  @max_precision = max_precision
end

Instance Attribute Details

#max_precisionInteger (readonly)

Returns:

  • (Integer)


10
11
12
# File 'lib/stupidedi/versions/common/element_types/r.rb', line 10

def max_precision
  @max_precision
end

Instance Method Details

#companion



35
36
37
# File 'lib/stupidedi/versions/common/element_types/r.rb', line 35

def companion
  FloatVal
end

#copy(changes = {}) ⇒ R

Returns:

  • (R)


24
25
26
27
28
29
30
31
32
33
# File 'lib/stupidedi/versions/common/element_types/r.rb', line 24

def copy(changes = {})
  R.new \
    changes.fetch(:id, @id),
    changes.fetch(:name, @name),
    changes.fetch(:min_length, @min_length),
    changes.fetch(:max_length, @max_length),
    changes.fetch(:max_precision, @max_precision),
    changes.fetch(:description, @description),
    changes.fetch(:parent, @parent)
end