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



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

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

Instance Attribute Details

#childrenArray<InterchangeVal> (readonly)



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

def children
  @children
end

Instance Method Details

#==(other) ⇒ Boolean



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

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

#copy(changes = {})



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

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

#inspectString



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

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

#leaf?Boolean



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

def leaf?
  false
end

#pretty_print(q)



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



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

def transmission?
  true
end