Commit fb3883e5 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #2941 from Mav7/master

Added range.h.md and edited re.h.md and version.h.md
parents 7967c76e 743432d4
#### 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
```
#### Macros
### REGEXP_CLASS
### Macros
#### REGEXP_CLASS
A string with the name of the REGEXP class.
#### 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.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment