Class: Stupidedi::Values::TransmissionVal

Inherits:
AbstractVal
  • Object
show all
Defined in:
lib/stupidedi/values/transmission_val.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractVal

#blank?, #characters, #component?, #composite?, #definition, #element?, #empty?, #functional_group?, #interchange?, #invalid?, #loop?, #present?, #repeated?, #segment?, #separator?, #simple?, #size, #table?, #transaction_set?, #valid?

Methods included from Color

ansi, #ansi

Constructor Details

#initialize(children = []) ⇒ TransmissionVal

Returns a new instance of TransmissionVal.


10
11
12
# File 'lib/stupidedi/values/transmission_val.rb', line 10

def initialize(children = [])
  @children = children
end

Instance Attribute Details

#childrenArray<InterchangeVal> (readonly)

Returns:


8
9
10
# File 'lib/stupidedi/values/transmission_val.rb', line 8

def children
  @children
end

Instance Method Details

#==(other) ⇒ Boolean

Returns:

  • (Boolean)

31
32
33
# File 'lib/stupidedi/values/transmission_val.rb', line 31

def ==(other)
  eql?(other) or other.children == @children
end

#copy(changes = {})


14
15
16
# File 'lib/stupidedi/values/transmission_val.rb', line 14

def copy(changes = {})
  TransmissionVal.new(changes.fetch(:children, @children))
end

#descriptor


18
19
20
# File 'lib/stupidedi/values/transmission_val.rb', line 18

def descriptor
  "root"
end

#inspectString

Returns:

  • (String)

51
52
53
# File 'lib/stupidedi/values/transmission_val.rb', line 51

def inspect
  ansi.envelope("TransmissionVal") + "(#{@children.map(&:inspect).join(", ")})"
end

#leaf?Boolean

Returns:

  • (Boolean)

22
23
24
# File 'lib/stupidedi/values/transmission_val.rb', line 22

def leaf?
  false
end

#pretty_print(q)

This method returns an undefined value.


36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/stupidedi/values/transmission_val.rb', line 36

def pretty_print(q)
  q.text(ansi.envelope("TransmissionVal"))
  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

#transmission?Boolean

Returns:

  • (Boolean)

26
27
28
# File 'lib/stupidedi/values/transmission_val.rb', line 26

def transmission?
  true
end