summaryrefslogtreecommitdiff
path: root/README.EXT
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-04-09 16:10:40 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-04-09 16:10:40 +0000
commit234c47e9fba274e1d07bdc39846cb9dbe3db569e (patch)
tree4aeb22100633f4e4d604b93b72505ba9eba117c0 /README.EXT
parent468a0bd4fa5f69407de50bb9645ab99efe327092 (diff)
* prec.c (prec_prec_f): documentation patch from
<gerardo.santana at gmail.com>. [ruby-core:07689] * bignum.c (rb_big_pow): second operand may be too big even if it's a Fixnum. [ruby-talk:187984] * README.EXT: update symbol description. [ruby-talk:188104] * COPYING: explicitly note GPLv2. [ruby-talk:187922] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10088 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'README.EXT')
-rw-r--r--README.EXT23
1 files changed, 18 insertions, 5 deletions
diff --git a/README.EXT b/README.EXT
index 4cfe80b..e5d3991 100644
--- a/README.EXT
+++ b/README.EXT
@@ -330,17 +330,30 @@ of the innermost method (which is defined by Ruby) can be accessed.
2.2.2 ID or Symbol
-You can invoke methods directly, without parsing the string. First I
-need to explain about symbols (whose data type is ID). ID is the
-integer number to represent Ruby's identifiers such as variable names.
-It can be accessed from Ruby in the form:
+You can invoke methods directly, without parsing the string. First I need
+to explain about ID. ID is the integer number to represent Ruby's
+identifiers such as variable names. The Ruby data type corresponding to ID
+is Symbol. It can be accessed from Ruby in the form:
:Identifier
-You can get the symbol value from a string within C code by using
+You can get the ID value from a string within C code by using
rb_intern(const char *name)
+You can retrieve ID from Ruby object (Symbol or String) given as an
+argument by using
+
+ rb_to_id(VALUE symbol)
+
+You can convert C ID to Ruby Symbol by using
+
+ VALUE ID2SYM(ID id)
+
+and to convert Ruby Symbol object to ID, use
+
+ ID SYM2ID(VALUE symbol)
+
2.2.3 Invoke Ruby method from C
To invoke methods directly, you can use the function below