MacRuby has some original methods. They does not exist in CRuby’s methods and Cocoa APIs. This content describes those methods.
Original Methods
String#transform
Transforms the string to uppercase/lowercase or another language characters. This method is implemented with ICU Transforms.
- transform(pattern) -> String
- [PARAM] pattern:
- Specifies transliteration identifier.
- [RETURN]
- Returns the transformed string.
- [PARAM] pattern:
1 2 3 4 5 6 7 8 |
|
String#pointer
Returns a Pointer object converted from String. Returned object corresponds to a variable of unsigned char *
.
Cocoa APIs has some methods which accepts the pointer variable.
String#pointer
may be used for these methods.
- pinter -> Pointer
- [RETURN]
- Returns a Pointer object converted from String.
- [RETURN]
1 2 3 4 5 6 |
|
String#to_data
Returns an NSData object which is converted from String.
- to_data -> NSData
- [RETURN]
- Returns a NSData object.
- [RETURN]
1 2 3 4 |
|
NSData#to_str
Returns a String object which is converted from NSData.
- to_str -> String
- [RETURN]
- Returns a String object
- [RETURN]
1 2 3 4 |
|
Kernel.framework
Loads a framework.
- framework -> bool
- [RETURN]
- Returns a true if loaded a framework. Otherwise, returns a false.
- [RETURN]
1 2 |
|
Kernel.load_bridge_support_file
Loads a Bridge Support file.
- load_bridge_support_file(filename) -> self
1 2 |
|
Kernel.load_plist
Returns an object which is converted from string of plist format.
- load_plist(string) -> Object
- [PARAM] string:
- Passes a string of plist format.
- [RETURN]
- Returns an object.
- [PARAM] string:
1 2 3 4 5 6 7 |
|
Object#to_plist
Returns a string of plist format which is converted from Object.
- to_plist -> String
- [RETURN]
- Returns a string of plist format.
- [RETURN]
1 2 3 4 5 6 |
|
Object#methods
Returns a methods list. CRuby also has Object#methods
, objc_methods
argument is added to MacRuby’s method.
- methods(include_inherited = true, objc_methods = false) -> [Symbol]
- [PARAM] include_inherited:
- If passes a true, looks up a recursively.
- [PARAM] objc_methods:
- If passes a true, returns the Ruby’s methods and Cocoa APIs.
- [RETURN]
- Returns a method list.
- [PARAM] include_inherited:
1 2 |
|
Range#relative_to
Returns a new Range instance which has negative values in rng
expanded relative to max
.
- relative_to(max) -> Range
- [PARAM] max:
- Specifies a max of Range.
- [RETURN]
- Returns a new Range instance.
- [PARAM] max:
1 2 3 4 |
|
BasicSocket#sendfile
Sends a file with socket. This method is implemented with sendfile(2).
- sendfile(file, offset, length) -> Integer
- [PARAM] file:
- Specifies a file path or readable IO object.
- [PARAM] offset:
- Specifies a offset as start position.
- [PARAM] length:
- Specifies a length to send.
- [RETURN]
- Returns a sent length.
- [PARAM] file:
1 2 3 4 5 6 7 |
|
Fixnum#popcnt
Returns the number of 1 bits set in the internal representation of Fixnum.
- popcnt -> Fixnum
1 2 3 4 5 6 7 8 |
|