Class: RPM::Source

Inherits:
Object
  • Object
show all
Defined in:
ext/rpm/source.c

Direct Known Subclasses

Icon, Patch

Instance Method Summary (collapse)

Constructor Details

- (Object) initialize

Creates a new Source object

Examples:

RPM::Source.new ('http://example.com/hoge/hoge.tar.bz2', 0)
RPM:: Source.new ('http://example.com/fuga/fuga.tar.gz', 1, true)

Parameters:

  • url (String)
  • source (Number)

    number (index)

  • nosource (Boolean)

    Sets the NoSource flag (default false)



# File 'ext/rpm/source.c'

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");
}

Instance Method Details

- (String) filename

Source's filename

Examples:

src = RPM::Source.new('http://example.com/hoge/hoge.tar.bz2', 0)
src.filename => 'hoge.tar.bz2'

Returns:

  • (String)

    Source's filename



# File 'ext/rpm/source.c'

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);
}

- (String) fullname

Source's fullname

Examples:

src = RPM::Source.new('http://example.com/hoge/hoge.tar.bz2', 0)
src.fullname => 'http://example.com/hoge/hoge.tar.bz2'

Returns:

  • (String)

    Source's fullname



# File 'ext/rpm/source.c'

VALUE
rpm_source_get_fullname(VALUE src)
{
    return rb_ivar_get(src, id_full);
}

- (Boolean) no?

Whether the NoSource flag is set

Examples:

src = RPM::Source.new('http://example.com/hoge/hoge.tar.bz2', 0, true)
src.no? => true

Returns:

  • (Boolean)

    Whether the NoSource flag is set



# File 'ext/rpm/source.c'

VALUE
rpm_source_is_no(VALUE src)
{
    return rb_ivar_get(src, id_no);
}

- (Number) num

Source's index

Examples:

src = RPM::Source.new ('http://example.com/hoge/hoge.tar.bz2', 0)
src.num => 0

Returns:

  • (Number)

    Source's index



# File 'ext/rpm/source.c'

VALUE
rpm_source_get_num(VALUE src)
{
    return rb_ivar_get(src, id_num);
}