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

+ (IdentifierVal) empty(usage, position)



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

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

+ (IdentifierVal) value(object, usage, position)



346
347
348
349
350
351
352
353
354
355
356
# File 'lib/stupidedi/versions/functional_groups/005010/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

- (Boolean) id?



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

def id?
  true
end

- (IdentifierVal) map



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

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

- (Boolean) too_long?



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

def too_long?
  false
end

- (Boolean) too_short?



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

def too_short?
  false
end