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

Inherits:
Base
  • Object
show all
Includes:
MixinHelper, NestedDeclarationHelper
Defined in:
lib/rbs/ast/declarations.rb

Defined Under Namespace

Classes: Self

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MixinHelper

#each_mixin

Methods included from NestedDeclarationHelper

#each_decl, #each_member

Constructor Details

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

Returns a new instance of Module.



256
257
258
259
260
261
262
263
264
# File 'lib/rbs/ast/declarations.rb', line 256

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

Instance Attribute Details

#annotationsObject (readonly)

Returns the value of attribute annotations.



252
253
254
# File 'lib/rbs/ast/declarations.rb', line 252

def annotations
  @annotations
end

#commentObject (readonly)

Returns the value of attribute comment.



254
255
256
# File 'lib/rbs/ast/declarations.rb', line 254

def comment
  @comment
end

#locationObject (readonly)

Returns the value of attribute location.



251
252
253
# File 'lib/rbs/ast/declarations.rb', line 251

def location
  @location
end

#membersObject (readonly)

Returns the value of attribute members.



250
251
252
# File 'lib/rbs/ast/declarations.rb', line 250

def members
  @members
end

#nameObject (readonly)

Returns the value of attribute name.



248
249
250
# File 'lib/rbs/ast/declarations.rb', line 248

def name
  @name
end

#self_typesObject (readonly)

Returns the value of attribute self_types.



253
254
255
# File 'lib/rbs/ast/declarations.rb', line 253

def self_types
  @self_types
end

#type_paramsObject (readonly)

Returns the value of attribute type_params.



249
250
251
# File 'lib/rbs/ast/declarations.rb', line 249

def type_params
  @type_params
end

Instance Method Details

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



266
267
268
269
270
271
272
# File 'lib/rbs/ast/declarations.rb', line 266

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

#hashObject



276
277
278
# File 'lib/rbs/ast/declarations.rb', line 276

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

#to_json(*a) ⇒ Object



280
281
282
283
284
285
286
287
288
289
290
291
# File 'lib/rbs/ast/declarations.rb', line 280

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