Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
59035eb3
Commit
59035eb3
authored
Nov 24, 2012
by
skandhas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add Module#include?
parent
32bacb21
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
src/class.c
src/class.c
+19
-0
No files found.
src/class.c
View file @
59035eb3
...
...
@@ -722,6 +722,24 @@ mrb_mod_include(mrb_state *mrb, mrb_value klass)
return
klass
;
}
static
mrb_value
mrb_mod_include_p
(
mrb_state
*
mrb
,
mrb_value
mod
)
{
mrb_value
mod2
;
struct
RClass
*
c
=
mrb_class_ptr
(
mod
);
mrb_get_args
(
mrb
,
"o"
,
&
mod2
);
mrb_check_type
(
mrb
,
mod2
,
MRB_TT_MODULE
);
while
(
c
)
{
if
(
c
->
tt
==
MRB_TT_ICLASS
)
{
if
(
c
->
c
==
mrb_class_ptr
(
mod2
))
return
mrb_true_value
();
}
c
=
c
->
super
;
}
return
mrb_false_value
();
}
static
mrb_value
mrb_mod_ancestors
(
mrb_state
*
mrb
,
mrb_value
self
)
{
...
...
@@ -1424,6 +1442,7 @@ mrb_init_class(mrb_state *mrb)
mrb_define_method
(
mrb
,
mod
,
"extend_object"
,
mrb_mod_extend_object
,
ARGS_REQ
(
1
));
/* 15.2.2.4.25 */
mrb_define_method
(
mrb
,
mod
,
"extended"
,
mrb_bob_init
,
ARGS_REQ
(
1
));
/* 15.2.2.4.26 */
mrb_define_method
(
mrb
,
mod
,
"include"
,
mrb_mod_include
,
ARGS_ANY
());
/* 15.2.2.4.27 */
mrb_define_method
(
mrb
,
mod
,
"include?"
,
mrb_mod_include_p
,
ARGS_REQ
(
1
));
/* 15.2.2.4.28 */
mrb_define_method
(
mrb
,
mod
,
"append_features"
,
mrb_mod_append_features
,
ARGS_REQ
(
1
));
/* 15.2.2.4.10 */
mrb_define_method
(
mrb
,
mod
,
"included"
,
mrb_bob_init
,
ARGS_REQ
(
1
));
/* 15.2.2.4.29 */
mrb_define_method
(
mrb
,
mod
,
"included_modules"
,
mrb_mod_included_modules
,
ARGS_NONE
());
/* 15.2.2.4.30 */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment