nghttpx: Add Env.phase method

This commit is contained in:
Tatsuhiro Tsujikawa 2015-09-05 01:11:20 +09:00
parent 45e0d42c51
commit 97f488a5c7
1 changed files with 9 additions and 0 deletions

View File

@ -74,6 +74,14 @@ mrb_value env_get_ctx(mrb_state *mrb, mrb_value self) {
}
} // namespace
namespace {
mrb_value env_get_phase(mrb_state *mrb, mrb_value self) {
auto data = static_cast<MRubyAssocData *>(mrb->ud);
return mrb_fixnum_value(data->phase);
}
} // namespace
namespace {
mrb_value env_get_remote_addr(mrb_state *mrb, mrb_value self) {
auto data = static_cast<MRubyAssocData *>(mrb->ud);
@ -95,6 +103,7 @@ void init_env_class(mrb_state *mrb, RClass *module) {
mrb_define_method(mrb, env_class, "req", env_get_req, MRB_ARGS_NONE());
mrb_define_method(mrb, env_class, "resp", env_get_resp, MRB_ARGS_NONE());
mrb_define_method(mrb, env_class, "ctx", env_get_ctx, MRB_ARGS_NONE());
mrb_define_method(mrb, env_class, "phase", env_get_phase, MRB_ARGS_NONE());
mrb_define_method(mrb, env_class, "remote_addr", env_get_remote_addr,
MRB_ARGS_NONE());
}