Class: Node::CLASS

Inherits:
Node show all
Defined in:
ext/internal/node/nodeinfo.c,
ext/internal/node/nodeinfo.c,
ext/cached/ruby-1.8.4/internal/node/nodeinfo.c,
ext/cached/ruby-1.8.4/internal/node/nodeinfo.c,
ext/cached/ruby-1.8.5/internal/node/nodeinfo.c,
ext/cached/ruby-1.8.5/internal/node/nodeinfo.c,
ext/cached/ruby-1.8.6/internal/node/nodeinfo.c,
ext/cached/ruby-1.8.6/internal/node/nodeinfo.c,
ext/cached/ruby-1.8.7/internal/node/nodeinfo.c,
ext/cached/ruby-1.8.7/internal/node/nodeinfo.c,
ext/cached/ruby-1.9.1/internal/node/nodeinfo.c,
ext/cached/ruby-1.9.1/internal/node/nodeinfo.c,
ext/cached/ruby-1.9.2/internal/node/nodeinfo.c,
ext/cached/ruby-1.9.2/internal/node/nodeinfo.c,
ext/cached/ruby-1.9.3/internal/node/nodeinfo.c,
ext/cached/ruby-1.9.3/internal/node/nodeinfo.c

Overview

Represents a class definition, e.g.:

class cpath
  body
end

or:

class cpath < super
  body
end

The class definition is evaluated in a new lexical scope.

The result of the expression is the last expression evaluated in the body.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#[], #_dump, _load, #address, #bytecode_compile, compile_string, #eval, #flags, #inspect, #members, #nd_file, #nd_line, #nd_type, #obfusc, #pretty_print, #swap, #to_a, #tree, type

Class Method Details

.membersArray

Return an array of strings containing the names of the node class’s members.

Returns:

  • (Array)


2793
2794
2795
2796
# File 'ext/internal/node/nodeinfo.c', line 2793

VALUE node_s_members(VALUE klass)
{
  return rb_iv_get(klass, "__member__");
}

Instance Method Details

#bodyObject

Return the Node’s body member. The return type is either a Node or an Object.



2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
# File 'ext/internal/node/nodeinfo.c', line 2076

static VALUE node_body(VALUE self)
{
  NODE * n;
  Data_Get_Struct(self, NODE, n);

  if(TYPE(n->nd_body) == T_NODE)
  {
    if(0 && nd_type(n) == NODE_OP_ASGN2)
    {
      return wrap_node_as(
        (NODE *)n->nd_body,
        rb_cNodeSubclass[NODE_OP_ASGN2_ARG]);
    }
    else
    {
      return wrap_node((NODE *)n->nd_body);
    }
  }
  else
  {
    return (VALUE)n->nd_body;
  }
}

#cpathObject

Return the Node’s cpath member. The return type is either a Node or an Object.



2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
# File 'ext/internal/node/nodeinfo.c', line 2156

static VALUE node_cpath(VALUE self)
{
  NODE * n;
  Data_Get_Struct(self, NODE, n);

  if(TYPE(n->nd_cpath) == T_NODE)
  {
    if(0 && nd_type(n) == NODE_OP_ASGN2)
    {
      return wrap_node_as(
        (NODE *)n->nd_cpath,
        rb_cNodeSubclass[NODE_OP_ASGN2_ARG]);
    }
    else
    {
      return wrap_node((NODE *)n->nd_cpath);
    }
  }
  else
  {
    return (VALUE)n->nd_cpath;
  }
}

#superObject

Return the Node’s super member. The return type is either a Node or an Object.



2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
# File 'ext/internal/node/nodeinfo.c', line 2650

static VALUE node_super(VALUE self)
{
  NODE * n;
  Data_Get_Struct(self, NODE, n);

  if(TYPE(n->nd_super) == T_NODE)
  {
    if(0 && nd_type(n) == NODE_OP_ASGN2)
    {
      return wrap_node_as(
        (NODE *)n->nd_super,
        rb_cNodeSubclass[NODE_OP_ASGN2_ARG]);
    }
    else
    {
      return wrap_node((NODE *)n->nd_super);
    }
  }
  else
  {
    return (VALUE)n->nd_super;
  }
}