Class: Stupidedi::Versions::Common::ElementTypes::FixnumVal
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?, #simple?, #string?, #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) ⇒ FixnumVal
279
280
281
|
# File 'lib/stupidedi/versions/common/element_types/nn.rb', line 279
def empty(usage, position)
self::Empty.new(usage, position)
end
|
.value(object, usage, position) ⇒ FixnumVal
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
|
# File 'lib/stupidedi/versions/common/element_types/nn.rb', line 284
def value(object, usage, position)
if object.is_a?(FixnumVal)
object elsif object.blank?
self::Empty.new(usage, position)
elsif object.is_a?(String)
factor = 10 ** usage.definition.precision
self::NonEmpty.new(object.to_d / factor, usage, position)
else
self::NonEmpty.new(object.to_d, usage, position)
end
rescue ArgumentError
self::Invalid.new(object, usage, position)
end
|
Instance Method Details
#numeric? ⇒ Boolean
44
45
46
|
# File 'lib/stupidedi/versions/common/element_types/nn.rb', line 44
def numeric?
true
end
|
#too_long? ⇒ Boolean
48
49
50
|
# File 'lib/stupidedi/versions/common/element_types/nn.rb', line 48
def too_long?
false
end
|
#too_short? ⇒ Boolean
52
53
54
|
# File 'lib/stupidedi/versions/common/element_types/nn.rb', line 52
def too_short?
false
end
|