summaryrefslogtreecommitdiff
path: root/README.EXT
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-26 13:28:15 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-11-26 13:28:15 (GMT)
commitc262acb4e023b6cd4e06b993508ab59a5f61607c (patch)
tree9df353785b5dabe025f621411cb51fc3da00e640 /README.EXT
parent3f37ba11a1911d10ddfc3da16c4d558501199a43 (diff)
ruby.h: export keyword argument functions
* include/ruby/ruby.h (rb_get_kwargs, rb_extract_keywords): export keyword argument functions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'README.EXT')
-rw-r--r--README.EXT20
1 files changed, 20 insertions, 0 deletions
diff --git a/README.EXT b/README.EXT
index 145d922..62e0450 100644
--- a/README.EXT
+++ b/README.EXT
@@ -1305,6 +1305,26 @@ rb_scan_args(int argc, VALUE *argv, const char *fmt, ...) ::
The number of given arguments, excluding an option hash or iterator
block, is returned.
+int rb_get_kwargs(VALUE keyword_hash, const ID *table, int required, int optional, VALUE *values)
+
+ Retrieves argument VALUEs bound to keywords, which directed by +table+
+ into +values+. First +required+ number of IDs referred by +table+ are
+ mandatory, and succeeding +optional+ (- +optional+ - 1 if
+ +optional+ is negative) number of IDs are optional. If a
+ mandatory key is not contained in +keyword_hash+, raises "missing
+ keyword" +ArgumentError+. If an optional key is not present in
+ +keyword_hash+, the corresponding element in +values+ is not changed.
+ If +optional+ is negative, rest of +keyword_hash+ are stored in the
+ next to optional +values+ as a new Hash, otherwise raises "unknown
+ keyword" +ArgumentError+.
+
+VALUE rb_extract_keywords(VALUE *original_hash)
+
+ Extrancts pairs whose key is a symbol into a new hash from a hash
+ object referred by +original_hash+. If the original hash contains
+ non-symbol keys, then they are copied to another hash and the new hash
+ is stored through +original_hash+, else 0 is stored.
+
== Invoking Ruby method
VALUE rb_funcall(VALUE recv, ID mid, int narg, ...) ::