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.



60
61
62
# File 'lib/rbs/definition_builder/method_builder.rb', line 60

def initialize(methods)
  @methods = methods
end

Instance Attribute Details

#methodsObject (readonly)

Returns the value of attribute methods.



58
59
60
# File 'lib/rbs/definition_builder/method_builder.rb', line 58

def methods
  @methods
end

Instance Method Details

#tsort_each_child(defn) ⇒ Object



68
69
70
71
72
73
74
# File 'lib/rbs/definition_builder/method_builder.rb', line 68

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



64
65
66
# File 'lib/rbs/definition_builder/method_builder.rb', line 64

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