Class: RBS::AST::Declarations::Module

Inherits:
Object
  • Object
show all
Defined in:
lib/rbs/ast/declarations.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, type_params:, members:, self_type:, annotations:, location:, comment:) ⇒ Module

Returns a new instance of Module.



155
156
157
158
159
160
161
162
163
# File 'lib/rbs/ast/declarations.rb', line 155

def initialize(name:, type_params:, members:, self_type:, annotations:, location:, comment:)
  @name = name
  @type_params = type_params
  @self_type = self_type
  @members = members
  @annotations = annotations
  @location = location
  @comment = comment
end

Instance Attribute Details

#annotationsObject (readonly)

Returns the value of attribute annotations.



151
152
153
# File 'lib/rbs/ast/declarations.rb', line 151

def annotations
  @annotations
end

#commentObject (readonly)

Returns the value of attribute comment.



153
154
155
# File 'lib/rbs/ast/declarations.rb', line 153

def comment
  @comment
end

#locationObject (readonly)

Returns the value of attribute location.



150
151
152
# File 'lib/rbs/ast/declarations.rb', line 150

def location
  @location
end

#membersObject (readonly)

Returns the value of attribute members.



149
150
151
# File 'lib/rbs/ast/declarations.rb', line 149

def members
  @members
end

#nameObject (readonly)

Returns the value of attribute name.



147
148
149
# File 'lib/rbs/ast/declarations.rb', line 147

def name
  @name
end

#self_typeObject (readonly)

Returns the value of attribute self_type.



152
153
154
# File 'lib/rbs/ast/declarations.rb', line 152

def self_type
  @self_type
end

#type_paramsObject (readonly)

Returns the value of attribute type_params.



148
149
150
# File 'lib/rbs/ast/declarations.rb', line 148

def type_params
  @type_params
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



165
166
167
168
169
170
171
# File 'lib/rbs/ast/declarations.rb', line 165

def ==(other)
  other.is_a?(Module) &&
    other.name == name &&
    other.type_params == type_params &&
    other.self_type == self_type &&
    other.members == members
end

#hashObject



175
176
177
# File 'lib/rbs/ast/declarations.rb', line 175

def hash
  self.class.hash ^ name.hash ^ type_params.hash ^ self_type.hash ^ members.hash
end

#to_json(*a) ⇒ Object



179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/rbs/ast/declarations.rb', line 179

def to_json(*a)
  {
    declaration: :module,
    name: name,
    type_params: type_params,
    members: members,
    self_type: self_type,
    annotations: annotations,
    location: location,
    comment: comment
  }.to_json(*a)
end