Class: OSA::ElementList
- Inherits:
-
Element
show all
- Includes:
- Enumerable
- Defined in:
- ext/rubyosa/rbosa.c,
lib/rubyosa/rbosa.rb
Constant Summary
Constants inherited
from Element
OSA::Element::REAL_NAME
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Element
#==, #__data__, __duplicate__, __new_object_specifier__, #__type__, #after, #before, from_rbobj, #inspect, #to_rbobj
Class Method Details
.__new__ ⇒ Object
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
|
# File 'ext/rubyosa/rbosa.c', line 541
static VALUE
rbosa_elementlist_new (int argc, VALUE *argv, VALUE self)
{
OSErr error;
AEDescList list;
VALUE ary;
int i;
rb_scan_args (argc, argv, "01", &ary);
if (!NIL_P (ary))
Check_Type (ary, T_ARRAY);
error = AECreateList (NULL, 0, false, &list);
if (error != noErr)
rb_raise (rb_eRuntimeError, "Cannot create Apple Event descriptor list : %s (%d)",
error_code_to_string (error), error);
if (!NIL_P (ary)) {
for (i = 0; i < RARRAY_LEN(ary); i++)
__rbosa_elementlist_add (&list, RARRAY_PTR(ary)[i], i + 1);
}
return rbosa_element_make (self, &list, Qnil);
}
|
Instance Method Details
#[] ⇒ Object
597
598
599
600
601
602
|
# File 'ext/rubyosa/rbosa.c', line 597
static VALUE
rbosa_elementlist_get (VALUE self, VALUE index)
{
AEKeyword keyword;
return __rbosa_elementlist_get (self, FIX2INT (index), &keyword);
}
|
#add ⇒ Object
567
568
569
570
571
572
573
574
575
576
|
# File 'ext/rubyosa/rbosa.c', line 567
static VALUE
rbosa_elementlist_add (VALUE self, VALUE element)
{
AEDescList * list;
list = (AEDescList *)rbosa_element_aedesc (self);
__rbosa_elementlist_add (list, __rbosa_elementlist_count (list) + 1, element);
return self;
}
|
#each ⇒ Object
123
124
125
|
# File 'lib/rubyosa/rbosa.rb', line 123
def each
self.size.times { |i| yield(self[i]) }
end
|
#size ⇒ Object
Also known as:
length
604
605
606
607
608
|
# File 'ext/rubyosa/rbosa.c', line 604
static VALUE
rbosa_elementlist_size (VALUE self)
{
return INT2FIX (__rbosa_elementlist_count ((AEDescList *)rbosa_element_aedesc (self)));
}
|