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?, #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, separators) ⇒ InvalidSegmentVal

Returns a new instance of InvalidSegmentVal.



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

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

Instance Attribute Details

#reasonString (readonly)

Returns:

  • (String)


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

def reason
  @reason
end

#segment_tokReader::SegmentTok (readonly)

Returns:



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

def segment_tok
  @segment_tok
end

Instance Method Details

#==(other) ⇒ Boolean

Returns:

  • (Boolean)


84
85
86
# File 'lib/stupidedi/values/invalid_segment_val.rb', line 84

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

#copy(changes = {}) ⇒ SegmentVal

Returns:



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

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

#definition

Returns nul.

Returns:

  • nul



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

def definition
  nil
end

#descriptorString

Returns:

  • (String)


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

def descriptor
  "segment #{@segment_tok.to_x12(@separators)} #{@reason}"
end

#empty?Boolean

Returns:

  • (Boolean)


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

def empty?
  true
end

#idSymbol

Returns:

  • (Symbol)


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

def id
  @segment_tok.id
end

#inspectString

Returns:

  • (String)


79
80
81
# File 'lib/stupidedi/values/invalid_segment_val.rb', line 79

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

#leaf?Boolean

Returns true.

Returns:

  • (Boolean)

    true



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

def leaf?
  true
end

#pretty_print(q)

This method returns an undefined value.



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

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

#segment?Boolean

Returns:

  • (Boolean)

    true



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

def segment?
  true
end

#sizeInteger

Number of segments in this subtree

Returns:

  • (Integer)


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

def size
  0
end

#usage

Returns nil.

Returns:

  • nil



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

def usage
  nil
end

#valid?Boolean

Returns:

  • (Boolean)


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

def valid?
  false
end