Class: Oppen::Token::Break

Inherits:
Oppen::Token show all
Defined in:
lib/oppen/token.rb

Overview

Break Token.

Direct Known Subclasses

LineBreak

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str = ' ', width: str.length, line_continuation: '', offset: 0) ⇒ Break

Returns a new instance of Break.

Raises:

  • (ArgumentError)


59
60
61
62
63
64
65
66
67
# File 'lib/oppen/token.rb', line 59

def initialize(str = ' ', width: str.length, line_continuation: '', offset: 0)
  raise ArgumentError, 'line_continuation cannot be nil' if line_continuation.nil?

  @line_continuation = line_continuation
  @offset = offset
  @str = str
  @width = width
  super()
end

Instance Attribute Details

#line_continuationString (readonly)

Returns If a new line is needed display this string before the new line.

Returns:

  • (String)

    If a new line is needed display this string before the new line



51
52
53
# File 'lib/oppen/token.rb', line 51

def line_continuation
  @line_continuation
end

#offsetInteger (readonly)

Returns Indentation.

Returns:

  • (Integer)

    Indentation.



53
54
55
# File 'lib/oppen/token.rb', line 53

def offset
  @offset
end

#strString (readonly)

Returns Break strings.

Returns:



55
56
57
# File 'lib/oppen/token.rb', line 55

def str
  @str
end

#widthInteger (readonly)

Returns:

  • (Integer)


57
58
59
# File 'lib/oppen/token.rb', line 57

def width
  @width
end

Instance Method Details

#to_sString

Returns:



70
# File 'lib/oppen/token.rb', line 70

def to_s = str