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.



63
64
65
66
67
# File 'lib/steep/index/rbs_index.rb', line 63

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

Instance Attribute Details

#declarationsObject (readonly)

Returns the value of attribute declarations.



60
61
62
# File 'lib/steep/index/rbs_index.rb', line 60

def declarations
  @declarations
end

#method_nameObject (readonly)

Returns the value of attribute method_name.



59
60
61
# File 'lib/steep/index/rbs_index.rb', line 59

def method_name
  @method_name
end

#referencesObject (readonly)

Returns the value of attribute references.



61
62
63
# File 'lib/steep/index/rbs_index.rb', line 61

def references
  @references
end

Instance Method Details

#add_declaration(decl) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/steep/index/rbs_index.rb', line 69

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
  else
    raise "Unexpected method declaration: #{decl}"
  end

  self
end