<<(val)
click to toggle source
def <<(val)
return self if @config.history_size.zero?
if @config.history_size.positive?
shift if size + 1 > @config.history_size
end
super(String.new(val, encoding: Reline.encoding_system_needs))
end
[](index)
click to toggle source
def [](index)
index = check_index(index) unless index.is_a?(Range)
super(index)
end
[]=(index, val)
click to toggle source
def []=(index, val)
index = check_index(index)
super(index, String.new(val, encoding: Reline.encoding_system_needs))
end
concat(*val)
click to toggle source
def concat(*val)
val.each do |v|
push(*v)
end
end
delete_at(index)
click to toggle source
def delete_at(index)
index = check_index(index)
super(index)
end
push(*val)
click to toggle source
def push(*val)
return self if @config.history_size.zero?
if @config.history_size.positive?
diff = size + val.size - @config.history_size
if diff > 0
if diff <= size
shift(diff)
else
diff -= size
clear
val.shift(diff)
end
end
end
super(*(val.map{ |v|
String.new(v, encoding: Reline.encoding_system_needs)
}))
end
to_s()
click to toggle source