Class: Stupidedi::Versions::FunctionalGroups::FiftyTen::ElementTypes::StringVal

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

Overview

See Also:

  • B.1.1.3.1.4 String

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?, #id?, #initialize, #leaf?, #numeric?, #simple?, #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) ⇒ StringVal



363
364
365
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/string_val.rb', line 363

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

.value(object, usage, position) ⇒ StringVal



368
369
370
371
372
373
374
375
376
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/string_val.rb', line 368

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

#mapStringVal



33
34
35
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/string_val.rb', line 33

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

#string?Boolean



20
21
22
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/string_val.rb', line 20

def string?
  true
end

#too_long?Boolean



24
25
26
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/string_val.rb', line 24

def too_long?
  false
end

#too_short?Boolean



28
29
30
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/string_val.rb', line 28

def too_short?
  false
end