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.



62
63
64
# File 'lib/rbs/definition_builder/method_builder.rb', line 62

def initialize(methods)
  @methods = methods
end

Instance Attribute Details

#methodsObject (readonly)

Returns the value of attribute methods.



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

def methods
  @methods
end

Instance Method Details

#tsort_each_child(defn) ⇒ Object



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

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



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

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