Class: RBS::DefinitionBuilder::MethodBuilder::Methods::Sorter

Inherits:
Object
  • Object
show all
Includes:
TSort
Defined in:
lib/rbs/definition_builder/method_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(methods) ⇒ Sorter

Returns a new instance of Sorter.



68
69
70
# File 'lib/rbs/definition_builder/method_builder.rb', line 68

def initialize(methods)
  @methods = methods
end

Instance Attribute Details

#methodsObject (readonly)

Returns the value of attribute methods.



66
67
68
# File 'lib/rbs/definition_builder/method_builder.rb', line 66

def methods
  @methods
end

Instance Method Details

#tsort_each_child(defn) ⇒ Object



76
77
78
79
80
81
82
# File 'lib/rbs/definition_builder/method_builder.rb', line 76

def tsort_each_child(defn)
  if (member = defn.original).is_a?(AST::Members::Alias)
    if old = methods[member.old_name]
      yield old
    end
  end
end

#tsort_each_node(&block) ⇒ Object



72
73
74
# File 'lib/rbs/definition_builder/method_builder.rb', line 72

def tsort_each_node(&block)
  methods.each_value(&block)
end