Module: RBS::AST::Members::Attribute

Included in:
AttrAccessor, AttrReader, AttrWriter
Defined in:
lib/rbs/ast/members.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#annotationsObject (readonly)

Returns the value of attribute annotations.



229
230
231
# File 'lib/rbs/ast/members.rb', line 229

def annotations
  @annotations
end

#commentObject (readonly)

Returns the value of attribute comment.



231
232
233
# File 'lib/rbs/ast/members.rb', line 231

def comment
  @comment
end

#ivar_nameObject (readonly)

Returns the value of attribute ivar_name.



228
229
230
# File 'lib/rbs/ast/members.rb', line 228

def ivar_name
  @ivar_name
end

#kindObject (readonly)

Returns the value of attribute kind.



227
228
229
# File 'lib/rbs/ast/members.rb', line 227

def kind
  @kind
end

#locationObject (readonly)

Returns the value of attribute location.



230
231
232
# File 'lib/rbs/ast/members.rb', line 230

def location
  @location
end

#nameObject (readonly)

Returns the value of attribute name.



225
226
227
# File 'lib/rbs/ast/members.rb', line 225

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



226
227
228
# File 'lib/rbs/ast/members.rb', line 226

def type
  @type
end

#visibilityObject (readonly)

Returns the value of attribute visibility.



232
233
234
# File 'lib/rbs/ast/members.rb', line 232

def visibility
  @visibility
end

Instance Method Details

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



245
246
247
248
249
250
251
252
# File 'lib/rbs/ast/members.rb', line 245

def ==(other)
  other.is_a?(self.class) &&
    other.name == name &&
    other.type == type &&
    other.ivar_name == ivar_name &&
    other.kind == kind &&
    other.visibility == visibility
end

#hashObject



256
257
258
# File 'lib/rbs/ast/members.rb', line 256

def hash
  name.hash ^ type.hash ^ ivar_name.hash ^ kind.hash ^ visibility.hash
end

#initialize(name:, type:, ivar_name:, kind:, annotations:, location:, comment:, visibility: nil) ⇒ Object



234
235
236
237
238
239
240
241
242
243
# File 'lib/rbs/ast/members.rb', line 234

def initialize(name:, type:, ivar_name:, kind:, annotations:, location:, comment:, visibility: nil)
  @name = name
  @type = type
  @ivar_name = ivar_name
  @annotations = annotations
  @location = location
  @comment = comment
  @kind = kind
  @visibility = visibility
end

#update(name: self.name, type: self.type, ivar_name: self.ivar_name, kind: self.kind, annotations: self.annotations, location: self.location, comment: self.comment, visibility: self.visibility) ⇒ Object



260
261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/rbs/ast/members.rb', line 260

def update(name: self.name, type: self.type, ivar_name: self.ivar_name, kind: self.kind, annotations: self.annotations, location: self.location, comment: self.comment, visibility: self.visibility)
  klass = _ = self.class
  klass.new(
    name: name,
    type: type,
    ivar_name: ivar_name,
    kind: kind,
    annotations: annotations,
    location: location,
    comment: comment,
    visibility: visibility
  )
end