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.



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

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.



159
160
161
# File 'lib/rbs/ast/declarations.rb', line 159

def annotations
  @annotations
end

#commentObject (readonly)

Returns the value of attribute comment.



161
162
163
# File 'lib/rbs/ast/declarations.rb', line 161

def comment
  @comment
end

#locationObject (readonly)

Returns the value of attribute location.



158
159
160
# File 'lib/rbs/ast/declarations.rb', line 158

def location
  @location
end

#membersObject (readonly)

Returns the value of attribute members.



157
158
159
# File 'lib/rbs/ast/declarations.rb', line 157

def members
  @members
end

#nameObject (readonly)

Returns the value of attribute name.



155
156
157
# File 'lib/rbs/ast/declarations.rb', line 155

def name
  @name
end

#self_typeObject (readonly)

Returns the value of attribute self_type.



160
161
162
# File 'lib/rbs/ast/declarations.rb', line 160

def self_type
  @self_type
end

#type_paramsObject (readonly)

Returns the value of attribute type_params.



156
157
158
# File 'lib/rbs/ast/declarations.rb', line 156

def type_params
  @type_params
end

Instance Method Details

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



173
174
175
176
177
178
179
# File 'lib/rbs/ast/declarations.rb', line 173

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

#hashObject



183
184
185
# File 'lib/rbs/ast/declarations.rb', line 183

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

#to_json(*a) ⇒ Object



187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/rbs/ast/declarations.rb', line 187

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