Class: JarEd::BufferLine

Inherits:
Object
  • Object
show all
Defined in:
lib/jared/buffer_line.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_textObject (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

Returns:

  • (Boolean)


13
14
15
# File 'lib/jared/buffer_line.rb', line 13

def blank?
  text == ""
end

#textObject



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