Class: Stupidedi::Interchanges::ElementTypes::SeparatorVal
Instance Attribute Summary
#position, #usage
Instance Method Summary
collapse
#allowed?, #component?, #date?, #id?, #leaf?, #numeric?, #simple?, #string?, #time?, #to_s
#element?, #size
#blank?, #characters, #component?, #composite?, #definition, #descriptor, #element?, #functional_group?, #interchange?, #invalid?, #leaf?, #loop?, #present?, #repeated?, #segment?, #simple?, #size, #table?, #transaction_set?, #transmission?
Methods included from Color
ansi, #ansi
Constructor Details
#initialize(value, usage, position) ⇒ SeparatorVal
Returns a new instance of SeparatorVal.
16
17
18
19
|
# File 'lib/stupidedi/interchanges/element_types/separator_val.rb', line 16
def initialize(value, usage, position)
@value = value
super(usage, position)
end
|
Class Method Details
.empty(usage, position)
65
66
67
|
# File 'lib/stupidedi/interchanges/element_types/separator_val.rb', line 65
def empty(usage, position)
SeparatorVal.new(nil, usage, position)
end
|
.value(character, usage, position) ⇒ SeparatorVal
70
71
72
|
# File 'lib/stupidedi/interchanges/element_types/separator_val.rb', line 70
def value(character, usage, position)
SeparatorVal.new(character, usage, position)
end
|
Instance Method Details
22
23
24
25
26
27
|
# File 'lib/stupidedi/interchanges/element_types/separator_val.rb', line 22
def copy(changes = {})
SeparatorVal.new \
changes.fetch(:value, @value),
changes.fetch(:usage, usage),
changes.fetch(:position, position)
end
|
#empty? ⇒ Boolean
33
34
35
|
# File 'lib/stupidedi/interchanges/element_types/separator_val.rb', line 33
def empty?
@value.blank?
end
|
#inspect
54
55
56
57
|
# File 'lib/stupidedi/interchanges/element_types/separator_val.rb', line 54
def inspect
id = definition.try{|d| ansi.bold("[#{d.id}]") }
ansi.element("SeparatorVal.value#{id}") + "(#{@value || "nil"})"
end
|
#separator? ⇒ Boolean
45
46
47
|
# File 'lib/stupidedi/interchanges/element_types/separator_val.rb', line 45
def separator?
true
end
|
#to_x12(truncate = true) ⇒ String
50
51
52
|
# File 'lib/stupidedi/interchanges/element_types/separator_val.rb', line 50
def to_x12(truncate = true)
@value.to_s
end
|
#too_long? ⇒ Boolean
41
42
43
|
# File 'lib/stupidedi/interchanges/element_types/separator_val.rb', line 41
def too_long?
@value.length > 1
end
|
#too_short? ⇒ Boolean
37
38
39
|
# File 'lib/stupidedi/interchanges/element_types/separator_val.rb', line 37
def too_short?
@value.length < 1
end
|
#valid? ⇒ Boolean
29
30
31
|
# File 'lib/stupidedi/interchanges/element_types/separator_val.rb', line 29
def valid?
true
end
|