Class: RPM::Source
- Inherits:
-
Object
- Object
- RPM::Source
- Defined in:
- ext/rpm/source.c
Instance Method Summary collapse
-
#filename ⇒ String
Source’s filename.
-
#fullname ⇒ String
(also: #to_s)
Source’s fullname.
-
#initialize(*args) ⇒ Object
constructor
Creates a new
Source
object. -
#no? ⇒ Boolean
Whether the NoSource flag is set.
-
#num ⇒ Number
Source’s index.
Constructor Details
#initialize(*args) ⇒ Object
Creates a new Source
object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'ext/rpm/source.c', line 30
static VALUE
source_initialize(int argc, VALUE* argv, VALUE src)
{
switch (argc) {
case 0: case 1:
rb_raise(rb_eArgError, "argument too few(2..3)");
case 2: case 3:
if (TYPE(argv[0]) != T_STRING) {
rb_raise(rb_eTypeError, "illegal argument type");
}
rb_ivar_set(src, id_full, argv[0]);
rb_ivar_set(src, id_num, rb_Integer(argv[1]));
if (argc == 3) {
rb_ivar_set(src, id_no, RTEST(argv[2]) ? Qtrue : Qfalse);
} else {
rb_ivar_set(src, id_no, Qfalse);
}
break;
default:
rb_raise(rb_eArgError, "argument too many(2..3)");
}
return src;
}
|
Instance Method Details
#filename ⇒ String
Returns Source’s filename.
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'ext/rpm/source.c', line 124
VALUE
rpm_source_get_filename(VALUE src)
{
VALUE fn = rb_ivar_get(src, id_fn);
if (NIL_P(fn)) {
VALUE full = rb_ivar_get(src, id_full);
const char* p = strrchr(RSTRING_PTR(full), '/');
if (p == NULL) {
p = RSTRING_PTR(full);
} else {
p++;
}
fn = rb_str_new2(p);
rb_ivar_set(src, id_fn, fn);
}
return fn;
}
|
#fullname ⇒ String Also known as: to_s
Returns Source’s fullname.
112 113 114 115 116 |
# File 'ext/rpm/source.c', line 112
VALUE
rpm_source_get_fullname(VALUE src)
{
return rb_ivar_get(src, id_full);
}
|
#no? ⇒ Boolean
Returns Whether the NoSource flag is set.
162 163 164 165 166 |
# File 'ext/rpm/source.c', line 162
VALUE
rpm_source_is_no(VALUE src)
{
return rb_ivar_get(src, id_no);
}
|
#num ⇒ Number
Returns Source’s index.
150 151 152 153 154 |
# File 'ext/rpm/source.c', line 150
VALUE
rpm_source_get_num(VALUE src)
{
return rb_ivar_get(src, id_num);
}
|