Class: Stupidedi::Values::FunctionalGroupVal
Overview
Instance Attribute Summary collapse
Instance Method Summary
collapse
#leaf?
Methods inherited from AbstractVal
#blank?, #characters, #component?, #composite?, #element?, #empty?, #interchange?, #invalid?, #loop?, #present?, #repeated?, #segment?, #separator?, #simple?, #size, #table?, #transaction_set?, #transmission?, #valid?
Methods included from Color
ansi, #ansi
Constructor Details
Returns a new instance of FunctionalGroupVal.
21
22
23
24
|
# File 'lib/stupidedi/values/functional_group_val.rb', line 21
def initialize(definition, children)
@definition, @children =
definition, children
end
|
Instance Attribute Details
17
18
19
|
# File 'lib/stupidedi/values/functional_group_val.rb', line 17
def children
@children
end
|
#definition ⇒ FunctionalGroupDef
14
15
16
|
# File 'lib/stupidedi/values/functional_group_val.rb', line 14
def definition
@definition
end
|
Instance Method Details
#==(other) ⇒ Object
96
97
98
99
100
|
# File 'lib/stupidedi/values/functional_group_val.rb', line 96
def ==(other)
eql?(other) or
(other.definition == @definition or
other.children == @children)
end
|
27
28
29
30
31
|
# File 'lib/stupidedi/values/functional_group_val.rb', line 27
def copy(changes = {})
FunctionalGroupVal.new \
changes.fetch(:definition, @definition),
changes.fetch(:children, @children)
end
|
#functional_group? ⇒ Boolean
35
36
37
|
# File 'lib/stupidedi/values/functional_group_val.rb', line 35
def functional_group?
true
end
|
#implementation ⇒ String?
61
62
63
64
65
|
# File 'lib/stupidedi/values/functional_group_val.rb', line 61
def implementation
if at(6) == "X"
at(7).to_s.slice(6, 4)
end
end
|
#inspect ⇒ String
92
93
94
|
# File 'lib/stupidedi/values/functional_group_val.rb', line 92
def inspect
ansi.envelope("Group") << "(#{@children.map(&:inspect).join(', ')})"
end
|
#pretty_print(q) ⇒ void
This method returns an undefined value.
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
# File 'lib/stupidedi/values/functional_group_val.rb', line 73
def pretty_print(q)
id = @definition.try do |d|
ansi.bold("[#{d.id.to_s}]")
end
q.text(ansi.envelope("FunctionalGroupVal#{id}"))
q.group(2, "(", ")") do
q.breakable ""
@children.each do |e|
unless q.current_group.first?
q.text ", "
q.breakable
end
q.pp e
end
end
end
|
#release ⇒ String?
47
48
49
50
51
|
# File 'lib/stupidedi/values/functional_group_val.rb', line 47
def release
if at(6) == "X"
at(7).to_s.slice(0, 4)
end
end
|
#segment_dict ⇒ Module
68
69
70
|
# File 'lib/stupidedi/values/functional_group_val.rb', line 68
def segment_dict
@definition.segment_dict
end
|
#subrelease ⇒ String?
54
55
56
57
58
|
# File 'lib/stupidedi/values/functional_group_val.rb', line 54
def subrelease
if at(6) == "X"
at(7).to_s.slice(0, 5)
end
end
|
#version ⇒ String?
40
41
42
43
44
|
# File 'lib/stupidedi/values/functional_group_val.rb', line 40
def version
if at(6) == "X"
at(7).to_s.slice(0, 3)
end
end
|