Class: Stupidedi::Values::InvalidSegmentVal

Inherits:
AbstractVal show all
Extended by:
Forwardable
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

- (InvalidSegmentVal) initialize(reason, segment_tok)

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)
  @reason, @segment_tok =
    reason, segment_tok
end

Instance Attribute Details

- (String) reason (readonly)

Returns:



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

def reason
  @reason
end

- (Reader::SegmentTok) segment_tok (readonly)

Returns:



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

def segment_tok
  @segment_tok
end

Instance Method Details

- (Boolean) ==(other)

Returns:

  • (Boolean)


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

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

- (SegmentVal) copy(changes = {})

Returns:



21
22
23
24
25
# 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)
end

- (Boolean) empty?

Returns:

  • (Boolean)


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

def empty?
  true
end

- (Symbol) id

Returns:



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

def id
  @segment_tok.id
end

- (String) inspect

Returns:



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

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

- (Boolean) leaf?

Returns true

Returns:

  • (Boolean)

    true



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

def leaf?
  true
end

- pretty_print(q)

This method returns an undefined value.



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

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

- (Boolean) segment?

Returns:

  • (Boolean)

    true



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

def segment?
  true
end

- (Integer) size

Number of segments in this subtree

Returns:



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

def size
  0
end

- usage

Returns nil

Returns:

  • nil



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

def usage
  nil
end

- (Boolean) valid?

Returns:

  • (Boolean)


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

def valid?
  false
end