Class: Stupidedi::Versions::FunctionalGroups::FortyTen::ElementTypes::IdentifierVal

Inherits:
Stupidedi::Values::SimpleElementVal show all
Defined in:
lib/stupidedi/versions/functional_groups/004010/element_types/identifier_val.rb

Overview

See Also:

  • B.1.1.3.1.3 Identifier

Direct Known Subclasses

Empty, Invalid, NonEmpty

Defined Under Namespace

Classes: Empty, Invalid, NonEmpty

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_x12

Methods inherited from Stupidedi::Values::AbstractElementVal

#element?, #size

Methods inherited from Stupidedi::Values::AbstractVal

#blank?, #characters, #component?, #composite?, #definition, #element?, #empty?, #functional_group?, #interchange?, #invalid?, #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



341
342
343
# File 'lib/stupidedi/versions/functional_groups/004010/element_types/identifier_val.rb', line 341

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

.value(object, usage, position) ⇒ IdentifierVal



346
347
348
349
350
351
352
353
354
355
356
# File 'lib/stupidedi/versions/functional_groups/004010/element_types/identifier_val.rb', line 346

def value(object, usage, position)
  if object.blank?
    self::Empty.new(usage, position)
  elsif object.respond_to?(:to_s)
    self::NonEmpty.new(object.to_s.rstrip, usage, position)
  else
    self::Invalid.new(object, usage, position)
  end
rescue
  self::Invalid.new(object, usage, position)
end

Instance Method Details

#id?Boolean



65
66
67
# File 'lib/stupidedi/versions/functional_groups/004010/element_types/identifier_val.rb', line 65

def id?
  true
end

#mapIdentifierVal



78
79
80
# File 'lib/stupidedi/versions/functional_groups/004010/element_types/identifier_val.rb', line 78

def map
  IdentifierVal.value(yield(value), usage, position)
end

#too_long?Boolean



69
70
71
# File 'lib/stupidedi/versions/functional_groups/004010/element_types/identifier_val.rb', line 69

def too_long?
  false
end

#too_short?Boolean



73
74
75
# File 'lib/stupidedi/versions/functional_groups/004010/element_types/identifier_val.rb', line 73

def too_short?
  false
end