Class: Curses::Item
- Inherits:
-
Data
- Object
- Data
- Curses::Item
- Defined in:
- ext/curses/curses.c
Instance Method Summary collapse
- #==(other) ⇒ Object
- #description ⇒ Object
-
#initialize(name, description) ⇒ Object
constructor
call-seq: new(name, description).
- #name ⇒ Object
Constructor Details
#initialize(name, description) ⇒ Object
call-seq:
new(name, description)
Construct a new Curses::Item.
3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 |
# File 'ext/curses/curses.c', line 3078
static VALUE
item_initialize(VALUE obj, VALUE name, VALUE description)
{
struct itemdata *itemp;
curses_init_screen();
TypedData_Get_Struct(obj, struct itemdata, &itemdata_type, itemp);
if (itemp->item) {
rb_raise(rb_eRuntimeError, "already initialized item");
}
name = rb_str_export_to_enc(name, terminal_encoding);
description = rb_str_export_to_enc(description, terminal_encoding);
itemp->item = new_item(StringValueCStr(name),
StringValueCStr(description));
if (itemp->item == NULL) {
check_curses_error(errno);
}
return obj;
}
|
Instance Method Details
#==(other) ⇒ Object
3110 3111 3112 3113 3114 3115 3116 3117 3118 |
# File 'ext/curses/curses.c', line 3110
static VALUE
item_eq(VALUE obj, VALUE other)
{
struct itemdata *item1, *item2;
GetITEM(obj, item1);
GetITEM(other, item2);
return item1->item == item2->item ? Qtrue : Qfalse;
}
|
#description ⇒ Object
3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 |
# File 'ext/curses/curses.c', line 3131
static VALUE
item_description_m(VALUE obj)
{
struct itemdata *itemp;
const char *desc;
GetITEM(obj, itemp);
desc = item_description(itemp->item);
return rb_external_str_new_with_enc(desc, strlen(desc), terminal_encoding);
}
|
#name ⇒ Object
3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 |
# File 'ext/curses/curses.c', line 3120
static VALUE
item_name_m(VALUE obj)
{
struct itemdata *itemp;
const char *name;
GetITEM(obj, itemp);
name = item_name(itemp->item);
return rb_external_str_new_with_enc(name, strlen(name), terminal_encoding);
}
|