Class: PLine::MethodInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/pline/minfo.rb,
ext/pline/minfo.c

Constant Summary collapse

ALL =
[]

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(iseq, obj, mid, singleton_p) ⇒ Object



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'ext/pline/minfo.c', line 99

static VALUE minfo_m_init(VALUE self, VALUE iseq, VALUE obj, VALUE mid, VALUE singleton_p)
{
  pline_method_info_t *m = DATA_PTR(self);
  VALUE spath, sline, eline;

  if (rb_obj_class(mid) != rb_cSymbol ||
      rb_obj_class(iseq) != rb_cISeq) {
    rb_raise(rb_eArgError, "invalid arguments");
  }

  m->obj = obj;
  m->mid = mid;
  m->spath = minfo_spath_from_iseq(iseq);
  m->sline = minfo_sline_from_iseq(iseq);
  m->eline = minfo_eline_from_iseq(iseq);
  m->singleton_p = singleton_p;

  return Qnil;
}

Class Method Details

.eachObject



14
15
16
17
18
19
# File 'lib/pline/minfo.rb', line 14

def self.each()
  ALL.each do |m|
    bug() unless m.is_a?(MethodInfo)
    yield(m)
  end
end

.register(m) ⇒ Object



9
10
11
12
# File 'lib/pline/minfo.rb', line 9

def self.register(m)
  bug() unless m.is_a?(MethodInfo)
  ALL << m
end

Instance Method Details

#descriptionObject



5
6
7
# File 'lib/pline/minfo.rb', line 5

def description()
  "#{obj}#{singleton? ? '.' : '#'}#{mid}: #{spath}(#{sline} - #{eline})"
end

#elineObject



143
144
145
146
147
# File 'ext/pline/minfo.c', line 143

static VALUE minfo_m_eline(VALUE self)
{
  pline_method_info_t *m = DATA_PTR(self);
  return m->eline;
}

#midObject



125
126
127
128
129
# File 'ext/pline/minfo.c', line 125

static VALUE minfo_m_mid(VALUE self)
{
  pline_method_info_t *m = DATA_PTR(self);
  return m->mid;
}

#objObject



119
120
121
122
123
# File 'ext/pline/minfo.c', line 119

static VALUE minfo_m_obj(VALUE self)
{
  pline_method_info_t *m = DATA_PTR(self);
  return m->obj;
}

#singleton?Boolean

Returns:

  • (Boolean)


149
150
151
152
153
# File 'ext/pline/minfo.c', line 149

static VALUE minfo_m_singleton_p(VALUE self)
{
  pline_method_info_t *m = DATA_PTR(self);
  return RTEST(m->singleton_p) ? Qtrue : Qfalse;
}

#slineObject



137
138
139
140
141
# File 'ext/pline/minfo.c', line 137

static VALUE minfo_m_sline(VALUE self)
{
  pline_method_info_t *m = DATA_PTR(self);
  return m->sline;
}

#spathObject



131
132
133
134
135
# File 'ext/pline/minfo.c', line 131

static VALUE minfo_m_spath(VALUE self)
{
  pline_method_info_t *m = DATA_PTR(self);
  return m->spath;
}