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



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

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

Instance Attribute Details

#childrenArray<InterchangeVal> (readonly)



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

def children
  @children
end

Instance Method Details

#==(other) ⇒ Boolean



28
29
30
# File 'lib/stupidedi/values/transmission_val.rb', line 28

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

#copy(changes = {})



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

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

#inspectString



48
49
50
# File 'lib/stupidedi/values/transmission_val.rb', line 48

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

#leaf?Boolean



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

def leaf?
  false
end

#pretty_print(q)



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

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



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

def transmission?
  true
end