Class: Stupidedi::Versions::Interchanges::FourOhOne::ElementDefs::SeparatorElementVal
Instance Attribute Summary
#position, #usage
Instance Method Summary
collapse
#allowed?, #component?, #date?, #id?, #leaf?, #numeric?, #simple?, #string?, #time?
#element?, #size
#blank?, #characters, #component?, #composite?, #definition, #element?, #functional_group?, #interchange?, #invalid?, #loop?, #present?, #repeated?, #segment?, #simple?, #size, #table?, #transaction_set?, #transmission?
Methods included from Color
ansi, #ansi
Constructor Details
Returns a new instance of SeparatorElementVal.
60
61
62
63
|
# File 'lib/stupidedi/versions/interchanges/00401/element_defs.rb', line 60
def initialize(value, usage, position)
@value = value
super(usage, position)
end
|
Class Method Details
.empty(usage, position) ⇒ Object
109
110
111
|
# File 'lib/stupidedi/versions/interchanges/00401/element_defs.rb', line 109
def empty(usage, position)
SeparatorElementVal.new(nil, usage, position)
end
|
119
120
121
|
# File 'lib/stupidedi/versions/interchanges/00401/element_defs.rb', line 119
def parse(character, usage, position)
SeparatorElementVal.new(character, usage, position)
end
|
114
115
116
|
# File 'lib/stupidedi/versions/interchanges/00401/element_defs.rb', line 114
def value(character, usage, position)
SeparatorElementVal.new(character, usage, position)
end
|
Instance Method Details
66
67
68
69
70
71
|
# File 'lib/stupidedi/versions/interchanges/00401/element_defs.rb', line 66
def copy(changes = {})
SeparatorElementVal.new \
changes.fetch(:value, @value),
changes.fetch(:usage, usage),
changes.fetch(:position, position)
end
|
#empty? ⇒ Boolean
77
78
79
|
# File 'lib/stupidedi/versions/interchanges/00401/element_defs.rb', line 77
def empty?
@value.blank?
end
|
98
99
100
101
|
# File 'lib/stupidedi/versions/interchanges/00401/element_defs.rb', line 98
def inspect
id = definition.try{|d| ansi.bold("[#{d.id}]") }
ansi.element("SeparatorElementVal.value#{id}") << "(#{@value || "nil"})"
end
|
#separator? ⇒ Boolean
89
90
91
|
# File 'lib/stupidedi/versions/interchanges/00401/element_defs.rb', line 89
def separator?
true
end
|
94
95
96
|
# File 'lib/stupidedi/versions/interchanges/00401/element_defs.rb', line 94
def to_x12
@value.to_s
end
|
#too_long? ⇒ Boolean
85
86
87
|
# File 'lib/stupidedi/versions/interchanges/00401/element_defs.rb', line 85
def too_long?
@value.length > 1
end
|
#too_short? ⇒ Boolean
81
82
83
|
# File 'lib/stupidedi/versions/interchanges/00401/element_defs.rb', line 81
def too_short?
@value.length < 1
end
|
#valid? ⇒ Boolean
73
74
75
|
# File 'lib/stupidedi/versions/interchanges/00401/element_defs.rb', line 73
def valid?
true
end
|