class TypeProf::Core::Box - typeprof: Ruby Standard Library Documentation

# class TypeProf::Core::Box

### Attributes

changes[R]
destroyed[R]
node[R]

### Public Class Methods

new(node) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/graph/box.rb, line 4
    def initialize(node)
      @node = node
      @changes = ChangeSet.new(node, self)
      @destroyed = false
      $box_counts[Box] += 1
      $box_counts[self.class] += 1
    end

### Public Instance Methods

destroy(genv) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/graph/box.rb, line 16
    def destroy(genv)
      $box_counts[self.class] -= 1
      $box_counts[Box] -= 1
      @destroyed = true
      @changes.reinstall(genv) # rollback all changes
    end

diagnostics(genv, &blk) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/graph/box.rb, line 42
    def diagnostics(genv, &blk)
      raise self.to_s if !@changes
      @changes.diagnostics.each(&blk)
      @changes.boxes.each_value do |box|
        box.diagnostics(genv, &blk)
      end
    end

inspect()
Alias for: to_s
on_type_added(genv, src_tyvar, added_types) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/graph/box.rb, line 28
    def on_type_added(genv, src_tyvar, added_types)
      genv.add_run(self)
    end

on_type_removed(genv, src_tyvar, removed_types) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/graph/box.rb, line 32
    def on_type_removed(genv, src_tyvar, removed_types)
      genv.add_run(self)
    end

reuse(new_node) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/graph/box.rb, line 23
    def reuse(new_node)
      @node = new_node
      @changes.reuse(new_node)
    end

run(genv) click to toggle source

    # File typeprof-0.30.1/lib/typeprof/core/graph/box.rb, line 36
    def run(genv)
      return if @destroyed
      run0(genv, @changes)
      @changes.reinstall(genv)
    end

to_s() click to toggle source

@@new_id = 0

    # File typeprof-0.30.1/lib/typeprof/core/graph/box.rb, line 52
    def to_s
      "#{ self.class.to_s.split("::").last[0] }#{ @id ||= $new_id += 1 }"
    end

Also aliased as: inspect