class ValueBuffer
Attributes
position[R]
Public Class Methods
new(s="")
click to toggle source
# File lib/mad_clibs/util/value_buffer.rb, line 4 def initialize(s="") self.value = s end
Public Instance Methods
<<(c)
click to toggle source
# File lib/mad_clibs/util/value_buffer.rb, line 21 def << c if @position < 0 @position = 0 end @buffer.insert(@position,c) @position += 1 end
backspace()
click to toggle source
# File lib/mad_clibs/util/value_buffer.rb, line 16 def backspace @buffer = @buffer[0..-2] left end
left()
click to toggle source
# File lib/mad_clibs/util/value_buffer.rb, line 8 def left @position -= 1 if @position >= 0 end
right()
click to toggle source
# File lib/mad_clibs/util/value_buffer.rb, line 12 def right @position += 1 if @position < value.length end
value()
click to toggle source
# File lib/mad_clibs/util/value_buffer.rb, line 34 def value @buffer end
value=(s)
click to toggle source
# File lib/mad_clibs/util/value_buffer.rb, line 29 def value=(s) @buffer = s.dup @position = -1 end