Class: Stupidedi::Versions::Common::ElementTypes::IdentifierVal

Inherits:
Stupidedi::Values::SimpleElementVal show all
Defined in:
lib/stupidedi/versions/common/element_types/id.rb

Overview

See Also:

  • B.1.1.3.1.3 Identifier

Direct Known Subclasses

Invalid, Valid

Defined Under Namespace

Classes: Empty, Invalid, NonEmpty, Valid

Instance Attribute Summary

Attributes inherited from Stupidedi::Values::SimpleElementVal

#position, #usage

Constructors collapse

Instance Method Summary collapse

Methods inherited from Stupidedi::Values::SimpleElementVal

#allowed?, #component?, #copy, #date?, #initialize, #leaf?, #numeric?, #simple?, #string?, #time?, #to_s, #to_x12, #valid?

Methods inherited from Stupidedi::Values::AbstractElementVal

#element?, #size

Methods inherited from Stupidedi::Values::AbstractVal

#blank?, #characters, #component?, #composite?, #definition, #descriptor, #element?, #empty?, #functional_group?, #interchange?, #invalid?, #leaf?, #loop?, #present?, #repeated?, #segment?, #separator?, #simple?, #size, #table?, #transaction_set?, #transmission?, #valid?

Methods included from Color

ansi, #ansi

Methods included from Inspect

#inspect

Constructor Details

This class inherits a constructor from Stupidedi::Values::SimpleElementVal

Class Method Details

.empty(usage, position) ⇒ IdentifierVal

Returns:



275
276
277
# File 'lib/stupidedi/versions/common/element_types/id.rb', line 275

def empty(usage, position)
  self::Empty.new(usage, position)
end

.value(object, usage, position) ⇒ IdentifierVal

Returns:



280
281
282
283
284
285
286
287
288
289
290
# File 'lib/stupidedi/versions/common/element_types/id.rb', line 280

def value(object, usage, position)
  if object.is_a?(IdentifierVal)
    object#.copy(:usage => usage, :position => position)
  elsif object.blank?
    self::Empty.new(usage, position)
  else
    self::NonEmpty.new(object.to_s.rstrip, usage, position)
  end
rescue
  self::Invalid.new(object, usage, position)
end

Instance Method Details

#id?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/stupidedi/versions/common/element_types/id.rb', line 56

def id?
  true
end

#too_long?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/stupidedi/versions/common/element_types/id.rb', line 60

def too_long?
  false
end

#too_short?Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/stupidedi/versions/common/element_types/id.rb', line 64

def too_short?
  false
end