summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2015-09-04 17:00:58 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2015-09-04 17:00:58 +0900
commitfb3883e57ed5da37dfe9cfc46b51ea06bb5e3239 (patch)
tree79bc840efd660dbd431629ef7012e7cdbcf48107
parent7967c76e1473a72bc91a436a16df7404dcd0caf2 (diff)
parent743432d4ecc2052f6808d1e1012eb356e85ccb1e (diff)
downloadmruby-fb3883e57ed5da37dfe9cfc46b51ea06bb5e3239.tar.gz
mruby-fb3883e57ed5da37dfe9cfc46b51ea06bb5e3239.zip
Merge pull request #2941 from Mav7/master
Added range.h.md and edited re.h.md and version.h.md
-rw-r--r--doc/api/mruby/range.h.md47
-rw-r--r--doc/api/mruby/re.h.md4
-rw-r--r--doc/api/mruby/version.h.md34
3 files changed, 66 insertions, 19 deletions
diff --git a/doc/api/mruby/range.h.md b/doc/api/mruby/range.h.md
new file mode 100644
index 000000000..188e6ede6
--- /dev/null
+++ b/doc/api/mruby/range.h.md
@@ -0,0 +1,47 @@
+#### mrb_range_new
+```C
+ mrb_value mrb_range_new(mrb_state*, mrb_value, mrb_value, mrb_bool);
+```
+Initializes a Range. The first mrb_value being the beginning value and second being the ending value.
+The third parameter is an mrb_bool value that represents the inclusion or exclusion of the last value.
+If the third parameter is 0 then it includes the last value in the range. If the third parameter is 1
+then it excludes the last value in the range.
+C code
+```C
+ #include <stdio.h>
+ #include <mruby.h>
+ #include "mruby/range.h" // Needs the range header.
+ #include "mruby/compile.h"
+
+ int main(int argc, char *argv[])
+ {
+ mrb_int beg = 0;
+ mrb_int end = 2;
+ mrb_bool exclude = 1;
+ mrb_value range_obj;
+ mrb_state *mrb = mrb_open();
+ if (!mrb) { /* handle error */ }
+ FILE *fp = fopen("test.rb","r");
+ range_obj = mrb_range_new(mrb, mrb_fixnum_value(beg), mrb_fixnum_value(end), exclude);
+ mrb_value obj = mrb_load_file(mrb,fp);
+ mrb_funcall(mrb, obj, "method_name", 1, range_obj);
+ fclose(fp);
+ mrb_close(mrb);
+ return 0;
+ }
+```
+Ruby code
+```Ruby
+ class Example_Class
+ def method_name(a)
+ puts a
+ puts a.class
+ end
+ end
+ Example_Class.new
+```
+This returns the following:
+```Ruby
+ 0...2
+ Range
+```
diff --git a/doc/api/mruby/re.h.md b/doc/api/mruby/re.h.md
index 01e18c6a5..f5cd2a71e 100644
--- a/doc/api/mruby/re.h.md
+++ b/doc/api/mruby/re.h.md
@@ -1,3 +1,3 @@
-#### Macros
-### REGEXP_CLASS
+### Macros
+#### REGEXP_CLASS
A string with the name of the REGEXP class.
diff --git a/doc/api/mruby/version.h.md b/doc/api/mruby/version.h.md
index daf87077d..f627b1da1 100644
--- a/doc/api/mruby/version.h.md
+++ b/doc/api/mruby/version.h.md
@@ -1,33 +1,33 @@
-#### Macros
-### MRUBY_RUBY_VERSION
+### Macros
+#### MRUBY_RUBY_VERSION
The version of Ruby used by mruby.
-### MRUBY_RUBY_ENGINE
+#### MRUBY_RUBY_ENGINE
Ruby engine.
-### MRUBY_VERSION
+#### MRUBY_VERSION
The mruby version.
-### MRUBY_RELEASE_MAJOR
+#### MRUBY_RELEASE_MAJOR
Major release version.
-### MRUBY_RELEASE_MINOR
+#### MRUBY_RELEASE_MINOR
Minor release version.
-### MRUBY_RELEASE_NO
+#### MRUBY_RELEASE_NO
Release number.
-### MRUBY_RELEASE_DATE
+#### MRUBY_RELEASE_DATE
Release date as a string.
-### MRUBY_RELEASE_YEAR
+#### MRUBY_RELEASE_YEAR
Release year.
-### MRUBY_RELEASE_MONTH
+#### MRUBY_RELEASE_MONTH
Release month.
-### MRUBY_RELEASE_DAY
+#### MRUBY_RELEASE_DAY
Release day.
-### MRUBY_BIRTH_YEAR
+#### MRUBY_BIRTH_YEAR
The year mruby was first created.
-### MRUBY_AUTHOR
+#### MRUBY_AUTHOR
Mruby's authors.
-### MRB_STRINGIZE0(expr)
+#### MRB_STRINGIZE0(expr)
A passed in expression.
-### MRB_STRINGIZE(expr)
+#### MRB_STRINGIZE(expr)
Passes in an expression to MRB_STRINGIZE0.
-### MRUBY_DESCRIPTION
+#### MRUBY_DESCRIPTION
mruby's version, and release date.
-### MRUBY_COPYRIGHT
+#### MRUBY_COPYRIGHT
mruby's copyright information.