class TypeProf::Core::NilFilter
Attributes
Public Class Methods
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/core/graph/filter.rb, line 9 def initialize(genv, node, prev_vtx, allow_nil) @node = node @next_vtx = Vertex.new(node) @allow_nil = allow_nil prev_vtx.add_edge(genv, self) end
Public Instance Methods
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/core/graph/filter.rb, line 18 def filter(types, nil_type) types.select {|ty| (ty == nil_type) == @allow_nil } end
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/core/graph/filter.rb, line 22 def on_type_added(genv, src_var, added_types) types = filter(added_types, genv.nil_type) @next_vtx.on_type_added(genv, self, types) unless types.empty? end
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/core/graph/filter.rb, line 27 def on_type_removed(genv, src_var, removed_types) types = filter(removed_types, genv.nil_type) @next_vtx.on_type_removed(genv, self, types) unless types.empty? end
Source
# File bundled-src/typeprof-0.31.1/lib/typeprof/core/graph/filter.rb, line 34 def to_s "NF#{ @id ||= $new_id += 1 } -> #{ @next_vtx }" end
@@new_id = 0