Class: Stupidedi::Values::TransmissionVal

Inherits:
AbstractVal 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.



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

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

Instance Attribute Details

#childrenArray<InterchangeVal> (readonly)

Returns:



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

def children
  @children
end

Instance Method Details

#==(other) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#copy(changes = {}) ⇒ Object



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

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

#inspectString

Returns:



46
47
48
# File 'lib/stupidedi/values/transmission_val.rb', line 46

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

#leaf?Boolean

Returns:

  • (Boolean)


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

def leaf?
  false
end

#pretty_print(q) ⇒ void

This method returns an undefined value.



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/stupidedi/values/transmission_val.rb', line 31

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)


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

def transmission?
  true
end