[331] | 1 | mruby-require
|
---|
| 2 | =============
|
---|
| 3 |
|
---|
| 4 | "mruby-require" is a mrbgem, provides
|
---|
| 5 | [require](http://docs.ruby-lang.org/ja/2.0.0/class/Kernel.html#M_REQUIRE) and
|
---|
| 6 | [load](http://docs.ruby-lang.org/ja/2.0.0/class/Kernel.html#M_LOAD) for mruby.
|
---|
| 7 |
|
---|
| 8 | ### Example:
|
---|
| 9 |
|
---|
| 10 | ```Ruby
|
---|
| 11 | # a.rb
|
---|
| 12 |
|
---|
| 13 | require "b"
|
---|
| 14 |
|
---|
| 15 | b = Bclass.new
|
---|
| 16 | p b.method
|
---|
| 17 | ```
|
---|
| 18 | ```Ruby
|
---|
| 19 | # b.rb
|
---|
| 20 |
|
---|
| 21 | class Bclass
|
---|
| 22 | def method
|
---|
| 23 | "BBB"
|
---|
| 24 | end
|
---|
| 25 | end
|
---|
| 26 | ```
|
---|
| 27 | ```sh
|
---|
| 28 | % mruby a.rb
|
---|
| 29 | "BBB"
|
---|
| 30 | ```
|
---|
| 31 |
|
---|
| 32 |
|
---|
| 33 | ### To run the tests:
|
---|
| 34 |
|
---|
| 35 | ruby run_test.rb
|
---|
| 36 |
|
---|
| 37 |
|
---|
| 38 | ## License
|
---|
| 39 |
|
---|
| 40 | Copyright (c) 2013 Internet Initiative Japan Inc.
|
---|
| 41 |
|
---|
| 42 | Permission is hereby granted, free of charge, to any person obtaining a
|
---|
| 43 | copy of this software and associated documentation files (the "Software"),
|
---|
| 44 | to deal in the Software without restriction, including without limitation
|
---|
| 45 | the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
---|
| 46 | and/or sell copies of the Software, and to permit persons to whom the
|
---|
| 47 | Software is furnished to do so, subject to the following conditions:
|
---|
| 48 |
|
---|
| 49 | The above copyright notice and this permission notice shall be included in
|
---|
| 50 | all copies or substantial portions of the Software.
|
---|
| 51 |
|
---|
| 52 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
| 53 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
| 54 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
---|
| 55 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
---|
| 56 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
---|
| 57 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
---|
| 58 | DEALINGS IN THE SOFTWARE.
|
---|
| 59 |
|
---|