Class: Stupidedi::Values::InvalidSegmentVal

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractVal

#blank?, #characters, #component?, #composite?, #definition, #element?, #functional_group?, #interchange?, #invalid?, #loop?, #present?, #repeated?, #separator?, #simple?, #table?, #transaction_set?, #transmission?

Methods included from Color

ansi, #ansi

Constructor Details

#initialize(reason, segment_tok) ⇒ InvalidSegmentVal



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

def initialize(reason, segment_tok)
  @reason, @segment_tok =
    reason, segment_tok
end

Instance Attribute Details

#reasonString (readonly)



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

def reason
  @reason
end

#segment_tokReader::SegmentTok (readonly)



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

def segment_tok
  @segment_tok
end

Instance Method Details

#==(other) ⇒ Boolean



76
77
78
# File 'lib/stupidedi/values/invalid_segment_val.rb', line 76

def ==(other)
  eql?(other)
end

#copy(changes = {}) ⇒ SegmentVal



24
25
26
27
28
# File 'lib/stupidedi/values/invalid_segment_val.rb', line 24

def copy(changes = {})
  InvalidSegmentVal.new \
    changes.fetch(:reason, @reason),
    changes.fetch(:segment_tok, @segment_tok)
end

#empty?Boolean



55
56
57
# File 'lib/stupidedi/values/invalid_segment_val.rb', line 55

def empty?
  true
end

#idSymbol



36
37
38
# File 'lib/stupidedi/values/invalid_segment_val.rb', line 36

def id
  @segment_tok.id
end

#inspectString



71
72
73
# File 'lib/stupidedi/values/invalid_segment_val.rb', line 71

def inspect
  ansi.invalid(@segment_tok.id.to_s)
end

#leaf?Boolean



41
42
43
# File 'lib/stupidedi/values/invalid_segment_val.rb', line 41

def leaf?
  true
end

#pretty_print(q)



65
66
67
68
# File 'lib/stupidedi/values/invalid_segment_val.rb', line 65

def pretty_print(q)
  id = ansi.invalid("[#{@segment_tok.id}]")
  q.text(ansi.segment("InvalidSegmentVal#{id}"))
end

#segment?Boolean



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

def segment?
  true
end

#sizeInteger

Number of segments in this subtree



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

def size
  0
end

#usage



60
61
62
# File 'lib/stupidedi/values/invalid_segment_val.rb', line 60

def usage
  nil
end

#valid?Boolean



45
46
47
# File 'lib/stupidedi/values/invalid_segment_val.rb', line 45

def valid?
  false
end