Class: JarEd::BufferLine
- Inherits:
-
Object
- Object
- JarEd::BufferLine
- Defined in:
- lib/jared/buffer_line.rb
Instance Attribute Summary collapse
-
#raw_text ⇒ Object
readonly
Returns the value of attribute raw_text.
Instance Method Summary collapse
- #blank? ⇒ Boolean
-
#initialize(raw_text) ⇒ BufferLine
constructor
A new instance of BufferLine.
- #text ⇒ Object
- #wrap(width:) ⇒ Object
Constructor Details
#initialize(raw_text) ⇒ BufferLine
Returns a new instance of BufferLine.
5 6 7 |
# File 'lib/jared/buffer_line.rb', line 5 def initialize(raw_text) @raw_text = raw_text end |
Instance Attribute Details
#raw_text ⇒ Object (readonly)
Returns the value of attribute raw_text.
3 4 5 |
# File 'lib/jared/buffer_line.rb', line 3 def raw_text @raw_text end |
Instance Method Details
#blank? ⇒ Boolean
13 14 15 |
# File 'lib/jared/buffer_line.rb', line 13 def blank? text == "" end |
#text ⇒ Object
9 10 11 |
# File 'lib/jared/buffer_line.rb', line 9 def text @text ||= raw_text.chomp end |
#wrap(width:) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/jared/buffer_line.rb', line 17 def wrap(width:) if blank? [""] else text.scan(/.{1,#{width}}/) end end |