1 /* ----------------------------------------------------------------------------- 2 * rubyautodoc.swg 3 * 4 * This file implements autodoc typemaps for some common ruby methods. 5 * ----------------------------------------------------------------------------- */ 6 7 %define AUTODOC(func, str) 8 %feature("autodoc", str) func; 9 %enddef 10 11 12 AUTODOC(to_i, "Convert $class to an Integer"); 13 AUTODOC(to_f, "Convert $class to a Float"); 14 AUTODOC(coerce, "Coerce class to a number"); 15 AUTODOC(to_a, "Convert $class to an Array"); 16 AUTODOC(to_s, "Convert class to a String representation"); 17 AUTODOC(inspect, "Inspect class and its contents"); 18 19 AUTODOC(at, "Return element at a certain index"); 20 AUTODOC(__getitem__, "Element accessor/slicing"); 21 AUTODOC(__setitem__, "Element setter/slicing"); 22 AUTODOC(slice, "Return a slice (portion of) the $class"); 23 24 AUTODOC(push, "Add an element at the end of the $class"); 25 AUTODOC(pop, "Remove and return element at the end of the $class"); 26 AUTODOC(shift, "Remove and return element at the beginning of the $class"); 27 AUTODOC(unshift, "Add one or more elements at the beginning of the $class"); 28 AUTODOC(first, "Return the first element in $class"); 29 AUTODOC(last, "Return the last element in $class"); 30 31 32 // 33 // Common Object methods 34 // 35 AUTODOC(hash, "Hashing function for class"); 36 AUTODOC(dup, "Create a duplicate of the class and unfreeze it if needed"); 37 AUTODOC(clone, "Create a duplicate of the class"); 38 39 // 40 // Container methods 41 // 42 AUTODOC(empty, "Check if $class is empty"); 43 AUTODOC(size, "Size or Length of the $class"); 44 AUTODOC(insert, "Insert one or more new elements in the $class"); 45 46 // 47 // Iterator methods (block) 48 // 49 AUTODOC(each, "Iterate thru each element in the $class. A block must be provided"); 50 AUTODOC(find, "Find an element in the class"); 51 AUTODOC(each_key, "Iterate thru each key element in the $class. A block must be provided"); 52 AUTODOC(each_value, "Iterate thru each key element in the $class. A block must be provided"); 53 AUTODOC(reject, "Iterate thru each element in the $class and reject those that fail a condition returning a new $class. A block must be provided"); 54 AUTODOC(reject_bang, "Iterate thru each element in the $class and reject those that fail a condition. A block must be provided. $class is modified in place"); 55 AUTODOC(select, "Iterate thru each element in the $class and select those that match a condition. A block must be provided"); 56 AUTODOC(delete_at, "Delete an element at a certain index"); 57 AUTODOC(__delete__, "Delete a matching element"); 58 59 60 // 61 // Hash methods 62 // 63 AUTODOC(keys, "Return an Array of key elements"); 64 AUTODOC(values, "Return an Array of value elements"); 65 AUTODOC(values_at, "Return an Array of value elements matching the conditions"); 66 67 68 // 69 // Operators 70 // 71 #ifdef __cplusplus 72 AUTODOC(operator==, "Equality comparison operator"); 73 AUTODOC(operator<=, "Lower or equal comparison operator"); 74 AUTODOC(operator>=, "Higher or equal comparison operator"); 75 AUTODOC(operator<, "Lower than comparison operator"); 76 AUTODOC(operator>, "Higher than comparison operator"); 77 AUTODOC(operator<<, "Left shifting or appending operator"); 78 AUTODOC(operator>>, "Right shifting operator or extracting operator"); 79 AUTODOC(operator+, "Add operator"); 80 AUTODOC(operator-, "Substraction operator"); 81 AUTODOC(operator+(), "Positive operator"); 82 AUTODOC(operator-(), "Negation operator"); 83 AUTODOC(operator&, "AND operator"); 84 AUTODOC(operator|, "OR operator"); 85 AUTODOC(operator^, "XOR operator"); 86 AUTODOC(operator~, "Invert operator"); 87 #endif 88 AUTODOC(__eq__, "Equality comparison operator"); 89 AUTODOC(__le__, "Lower or equal comparison operator"); 90 AUTODOC(__ge__, "Higher or equal comparison operator"); 91 AUTODOC(__lt__, "Lower than comparison operator"); 92 AUTODOC(__gt__, "Higher than comparison operator"); 93 AUTODOC(__lshift__, "Left shifting or appending operator"); 94 AUTODOC(__rshift__, "Right shifting operator or extracting operator"); 95 AUTODOC(__add___, "Add operator"); 96 AUTODOC(__sub__, "Substraction operator"); 97 AUTODOC(__pos__, "Positive operator"); 98 AUTODOC(__neg__, "Negation operator"); 99 AUTODOC(__and__, "AND operator"); 100 AUTODOC(__or__, "OR operator"); 101 AUTODOC(__xor__, "XOR operator"); 102 AUTODOC(__negate__, "Invert operator"); 103 AUTODOC(__pow__, "Exponential operator"); 104 AUTODOC(__divmod__, "Modulo of division"); 105 AUTODOC(__cmp__, "Comparison operator. Returns < 0 for less than, 0 for equal or > 1 for higher than."); 106