Class: Stupidedi::Values::TableVal
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
#initialize(definition, children) ⇒ TableVal
Returns a new instance of TableVal.
17
18
19
20
|
# File 'lib/stupidedi/values/table_val.rb', line 17
def initialize(definition, children)
@definition, @children =
definition, children
end
|
Instance Attribute Details
13
14
15
|
# File 'lib/stupidedi/values/table_val.rb', line 13
def children
@children
end
|
#definition ⇒ TableDef
10
11
12
|
# File 'lib/stupidedi/values/table_val.rb', line 10
def definition
@definition
end
|
Instance Method Details
#==(other) ⇒ Boolean
60
61
62
63
64
|
# File 'lib/stupidedi/values/table_val.rb', line 60
def ==(other)
eql?(other) or
(other.definition == @definition and
other.children == @children)
end
|
#copy(changes = {}) ⇒ TableVal
23
24
25
26
27
|
# File 'lib/stupidedi/values/table_val.rb', line 23
def copy(changes = {})
TableVal.new \
changes.fetch(:definition, @definition),
changes.fetch(:children, @children)
end
|
#inspect ⇒ String
55
56
57
|
# File 'lib/stupidedi/values/table_val.rb', line 55
def inspect
ansi.table("Table") << "(#{@children.map(&:inspect).join(', ')})"
end
|
#pretty_print(q) ⇒ void
This method returns an undefined value.
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/stupidedi/values/table_val.rb', line 36
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? ⇒ Object
31
32
33
|
# File 'lib/stupidedi/values/table_val.rb', line 31
def table?
true
end
|