Class: HISTORY
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Enumerable
|
|
Inherits: | Object |
Defined in: | ext/readline/readline.c |
Class Attribute Summary
- .empty? ⇒ Boolean readonly
Class Method Summary
- .<<(str)
- .[](index)
- .[]=(index, str)
- .clear
- .delete_at(index)
- .each
- .length (also: .size)
- .pop
- .push(*args)
- .shift
-
.size
Alias for .length.
- .to_s
Class Attribute Details
.empty? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'ext/readline/readline.c', line 1840
static VALUE hist_empty_p(VALUE self) { return history_length == 0 ? Qtrue : Qfalse; }
Class Method Details
.<<(str)
[ GitHub ]# File 'ext/readline/readline.c', line 1754
static VALUE hist_push(VALUE self, VALUE str) { OutputStringValue(str); add_history(RSTRING_PTR(str)); return self; }
.[](index)
[ GitHub ]# File 'ext/readline/readline.c', line 1711
static VALUE hist_get(VALUE self, VALUE index) { HIST_ENTRY *entry = NULL; int i; i = NUM2INT(index); if (i < 0) { i += history_length; } if (i >= 0) { entry = history_get(history_get_offset_func(i)); } if (entry == NULL) { rb_raise(rb_eIndexError, "invalid index"); } return rb_locale_str_new_cstr(entry->line); }
.[]=(index, str)
[ GitHub ]# File 'ext/readline/readline.c', line 1731
static VALUE hist_set(VALUE self, VALUE index, VALUE str) { HIST_ENTRY *entry = NULL; int i; i = NUM2INT(index); OutputStringValue(str); if (i < 0) { i += history_length; } if (i >= 0) { entry = replace_history_entry(history_replace_offset_func(i), RSTRING_PTR(str), NULL); } if (entry == NULL) { rb_raise(rb_eIndexError, "invalid index"); } return str; }
.clear
[ GitHub ]# File 'ext/readline/readline.c', line 1861
static VALUE hist_clear(VALUE self) { clear_history(); return self; }
.delete_at(index)
[ GitHub ]# File 'ext/readline/readline.c', line 1846
static VALUE hist_delete_at(VALUE self, VALUE index) { int i; i = NUM2INT(index); if (i < 0) i += history_length; if (i < 0 || i > history_length - 1) { rb_raise(rb_eIndexError, "invalid index"); } return rb_remove_history(i); }
.each
[ GitHub ]# File 'ext/readline/readline.c', line 1817
static VALUE hist_each(VALUE self) { HIST_ENTRY *entry; int i; RETURN_ENUMERATOR(self, 0, 0); for (i = 0; i < history_length; i++) { entry = history_get(history_get_offset_func(i)); if (entry == NULL) break; rb_yield(rb_locale_str_new_cstr(entry->line)); } return self; }
.length Also known as: .size
[ GitHub ]# File 'ext/readline/readline.c', line 1834
static VALUE hist_length(VALUE self) { return INT2NUM(history_length); }
.pop
[ GitHub ]# File 'ext/readline/readline.c', line 1797
static VALUE hist_pop(VALUE self) { if (history_length > 0) { return rb_remove_history(history_length - 1); } else { return Qnil; } }
.push(*args)
[ GitHub ]# File 'ext/readline/readline.c', line 1762
static VALUE hist_push_method(int argc, VALUE *argv, VALUE self) { VALUE str; while (argc--) { str = *argv++; OutputStringValue(str); add_history(RSTRING_PTR(str)); } return self; }
.shift
[ GitHub ]# File 'ext/readline/readline.c', line 1807
static VALUE hist_shift(VALUE self) { if (history_length > 0) { return rb_remove_history(0); } else { return Qnil; } }
.size
Alias for .length.
.to_s
[ GitHub ]# File 'ext/readline/readline.c', line 1693
static VALUE hist_to_s(VALUE self) { return rb_str_new_cstr("HISTORY"); }