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



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

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

Instance Attribute Details

#reasonString (readonly)



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

def reason
  @reason
end

#segment_tokReader::SegmentTok (readonly)



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

def segment_tok
  @segment_tok
end

Instance Method Details

#==(other) ⇒ Boolean



74
75
76
# File 'lib/stupidedi/values/invalid_segment_val.rb', line 74

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

#copy(changes = {}) ⇒ SegmentVal



22
23
24
25
26
# File 'lib/stupidedi/values/invalid_segment_val.rb', line 22

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

#empty?Boolean



53
54
55
# File 'lib/stupidedi/values/invalid_segment_val.rb', line 53

def empty?
  true
end

#idSymbol



34
35
36
# File 'lib/stupidedi/values/invalid_segment_val.rb', line 34

def id
  @segment_tok.id
end

#inspectString



69
70
71
# File 'lib/stupidedi/values/invalid_segment_val.rb', line 69

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

#leaf?Boolean



39
40
41
# File 'lib/stupidedi/values/invalid_segment_val.rb', line 39

def leaf?
  true
end

#pretty_print(q)



63
64
65
66
# File 'lib/stupidedi/values/invalid_segment_val.rb', line 63

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

#segment?Boolean



49
50
51
# File 'lib/stupidedi/values/invalid_segment_val.rb', line 49

def segment?
  true
end

#sizeInteger

Number of segments in this subtree



29
30
31
# File 'lib/stupidedi/values/invalid_segment_val.rb', line 29

def size
  0
end

#usage



58
59
60
# File 'lib/stupidedi/values/invalid_segment_val.rb', line 58

def usage
  nil
end

#valid?Boolean



43
44
45
# File 'lib/stupidedi/values/invalid_segment_val.rb', line 43

def valid?
  false
end