Class: Stupidedi::Versions::Common::ElementTypes::StringVal
Overview
Defined Under Namespace
Classes: Empty, Invalid, NonEmpty, Valid
Instance Attribute Summary
#position, #usage
Instance Method Summary
collapse
#allowed?, #component?, #copy, #date?, #id?, #initialize, #leaf?, #numeric?, #simple?, #time?, #to_s, #to_x12, #valid?
#element?, #size
#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
Class Method Details
.empty(usage, position) ⇒ StringVal
346
347
348
|
# File 'lib/stupidedi/versions/common/element_types/an.rb', line 346
def empty(usage, position)
self::Empty.new(usage, position)
end
|
.value(object, usage, position) ⇒ StringVal
351
352
353
354
355
356
357
358
359
360
361
362
363
|
# File 'lib/stupidedi/versions/common/element_types/an.rb', line 351
def value(object, usage, position)
if object.is_a?(StringVal)
object elsif object.blank?
self::Empty.new(usage, position)
elsif object.kind_of?(Date) or object.kind_of?(Time)
self::Invalid.new(object, usage, position)
else
self::NonEmpty.new(object.to_s.rstrip, usage, position)
end
rescue
self::Invalid.new(object, usage, position)
end
|
Instance Method Details
#string? ⇒ Boolean
134
135
136
|
# File 'lib/stupidedi/versions/common/element_types/an.rb', line 134
def string?
true
end
|
#too_long? ⇒ Boolean
138
139
140
|
# File 'lib/stupidedi/versions/common/element_types/an.rb', line 138
def too_long?
false
end
|
#too_short? ⇒ Boolean
142
143
144
|
# File 'lib/stupidedi/versions/common/element_types/an.rb', line 142
def too_short?
false
end
|