Class: Steep::Index::RBSIndex::MethodEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/steep/index/rbs_index.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method_name:) ⇒ MethodEntry

Returns a new instance of MethodEntry.



71
72
73
74
75
# File 'lib/steep/index/rbs_index.rb', line 71

def initialize(method_name:)
  @method_name = method_name
  @declarations = Set[]
  @references = Set[]
end

Instance Attribute Details

#declarationsObject (readonly)

Returns the value of attribute declarations.



68
69
70
# File 'lib/steep/index/rbs_index.rb', line 68

def declarations
  @declarations
end

#method_nameObject (readonly)

Returns the value of attribute method_name.



67
68
69
# File 'lib/steep/index/rbs_index.rb', line 67

def method_name
  @method_name
end

#referencesObject (readonly)

Returns the value of attribute references.



69
70
71
# File 'lib/steep/index/rbs_index.rb', line 69

def references
  @references
end

Instance Method Details

#add_declaration(decl) ⇒ Object



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/steep/index/rbs_index.rb', line 77

def add_declaration(decl)
  case decl
  when RBS::AST::Members::MethodDefinition,
    RBS::AST::Members::Alias,
    RBS::AST::Members::AttrWriter,
    RBS::AST::Members::AttrReader,
    RBS::AST::Members::AttrAccessor
    declarations << decl
  when RBS::AST::Ruby::Members::DefMember
    declarations << decl
  else
    raise "Unexpected method declaration: #{decl}"
  end

  self
end