Class: Steep::Index::RBSIndex::ConstantEntry

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(const_name:) ⇒ ConstantEntry

Returns a new instance of ConstantEntry.



99
100
101
102
# File 'lib/steep/index/rbs_index.rb', line 99

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

Instance Attribute Details

#const_nameObject (readonly)

Returns the value of attribute const_name.



96
97
98
# File 'lib/steep/index/rbs_index.rb', line 96

def const_name
  @const_name
end

#declarationsObject (readonly)

Returns the value of attribute declarations.



97
98
99
# File 'lib/steep/index/rbs_index.rb', line 97

def declarations
  @declarations
end

Instance Method Details

#add_declaration(decl) ⇒ Object



104
105
106
107
108
109
110
111
112
113
# File 'lib/steep/index/rbs_index.rb', line 104

def add_declaration(decl)
  case decl
  when RBS::AST::Declarations::Constant, RBS::AST::Ruby::Declarations::ConstantDecl
    declarations << decl
  else
    raise
  end

  self
end