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

Returns a new instance of 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)

Returns:

  • (String)


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

def reason
  @reason
end

#segment_tokReader::SegmentTok (readonly)

Returns:



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

def segment_tok
  @segment_tok
end

Instance Method Details

#==(other) ⇒ Boolean

Returns:

  • (Boolean)


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

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

#copy(changes = {}) ⇒ SegmentVal

Returns:



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

Returns:

  • (Boolean)


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

def empty?
  true
end

#idSymbol

Returns:

  • (Symbol)


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

def id
  @segment_tok.id
end

#inspectString

Returns:

  • (String)


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

Returns true.

Returns:

  • (Boolean)

    true



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

def leaf?
  true
end

#pretty_print(q) ⇒ void

This method returns an undefined value.



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

Returns:

  • (Boolean)

    true



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

def segment?
  true
end

#sizeInteger

Number of segments in this subtree

Returns:

  • (Integer)


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

def size
  0
end

#usageObject

Returns nil.

Returns:

  • nil



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

def usage
  nil
end

#valid?Boolean

Returns:

  • (Boolean)


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

def valid?
  false
end