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)


53
54
55
56
57
58
59
60
61
# File 'lib/oppen/token.rb', line 53

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



45
46
47
# File 'lib/oppen/token.rb', line 45

def line_continuation
  @line_continuation
end

#offsetInteger (readonly)

Returns Indentation.

Returns:

  • (Integer)

    Indentation.



47
48
49
# File 'lib/oppen/token.rb', line 47

def offset
  @offset
end

#strString (readonly)

Returns Break strings.

Returns:



49
50
51
# File 'lib/oppen/token.rb', line 49

def str
  @str
end

#widthInteger (readonly)

Returns:

  • (Integer)


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

def width
  @width
end

Instance Method Details

#to_sString

Returns:



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

def to_s = str