Class: Stupidedi::Versions::FunctionalGroups::FiftyTen::ElementTypes::IdentifierVal

Inherits:
Stupidedi::Values::SimpleElementVal show all
Defined in:
lib/stupidedi/versions/functional_groups/005010/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



332
333
334
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 332

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

.value(object, usage, position) ⇒ IdentifierVal



337
338
339
340
341
342
343
344
345
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 337

def value(object, usage, position)
  if 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



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

def id?
  true
end

#mapIdentifierVal



81
82
83
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 81

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

#too_long?Boolean



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

def too_long?
  false
end

#too_short?Boolean



76
77
78
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 76

def too_short?
  false
end