Class: Stupidedi::Values::TableVal
- Inherits:
-
AbstractVal
show all
- Includes:
- SegmentValGroup
- Defined in:
- lib/stupidedi/values/table_val.rb
Instance Attribute Summary (collapse)
Instance Method Summary
(collapse)
#leaf?
Methods inherited from AbstractVal
#blank?, #characters, #component?, #composite?, #element?, #empty?, #functional_group?, #interchange?, #invalid?, #loop?, #present?, #repeated?, #segment?, #separator?, #simple?, #size, #transaction_set?, #transmission?, #valid?
Methods included from Color
ansi, #ansi
Constructor Details
- (TableVal) initialize(definition, children)
A new instance of TableVal
15
16
17
18
|
# File 'lib/stupidedi/values/table_val.rb', line 15
def initialize(definition, children)
@definition, @children =
definition, children
end
|
Instance Attribute Details
11
12
13
|
# File 'lib/stupidedi/values/table_val.rb', line 11
def children
@children
end
|
- (TableDef) definition
8
9
10
|
# File 'lib/stupidedi/values/table_val.rb', line 8
def definition
@definition
end
|
Instance Method Details
- (Boolean) ==(other)
58
59
60
61
62
|
# File 'lib/stupidedi/values/table_val.rb', line 58
def ==(other)
eql?(other) or
(other.definition == @definition and
other.children == @children)
end
|
- (TableVal) copy(changes = {})
21
22
23
24
25
|
# File 'lib/stupidedi/values/table_val.rb', line 21
def copy(changes = {})
TableVal.new \
changes.fetch(:definition, @definition),
changes.fetch(:children, @children)
end
|
53
54
55
|
# File 'lib/stupidedi/values/table_val.rb', line 53
def inspect
ansi.table("Table") << "(#{@children.map(&:inspect).join(', ')})"
end
|
- pretty_print(q)
This method returns an undefined value.
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/stupidedi/values/table_val.rb', line 34
def pretty_print(q)
id = @definition.try do |d|
ansi.bold("[#{d.id.to_s}]")
end
q.text(ansi.table("TableVal#{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
|
- table?
29
30
31
|
# File 'lib/stupidedi/values/table_val.rb', line 29
def table?
true
end
|