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.



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

def initialize(methods)
  @methods = methods
end

Instance Attribute Details

#methodsObject (readonly)

Returns the value of attribute methods.



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

def methods
  @methods
end

Instance Method Details

#tsort_each_child(defn) ⇒ Object



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

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



70
71
72
# File 'lib/rbs/definition_builder/method_builder.rb', line 70

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