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.



221
222
223
# File 'lib/rbs/ast/members.rb', line 221

def annotations
  @annotations
end

#commentObject (readonly)

Returns the value of attribute comment.



223
224
225
# File 'lib/rbs/ast/members.rb', line 223

def comment
  @comment
end

#ivar_nameObject (readonly)

Returns the value of attribute ivar_name.



220
221
222
# File 'lib/rbs/ast/members.rb', line 220

def ivar_name
  @ivar_name
end

#kindObject (readonly)

Returns the value of attribute kind.



219
220
221
# File 'lib/rbs/ast/members.rb', line 219

def kind
  @kind
end

#locationObject (readonly)

Returns the value of attribute location.



222
223
224
# File 'lib/rbs/ast/members.rb', line 222

def location
  @location
end

#nameObject (readonly)

Returns the value of attribute name.



217
218
219
# File 'lib/rbs/ast/members.rb', line 217

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



218
219
220
# File 'lib/rbs/ast/members.rb', line 218

def type
  @type
end

Instance Method Details

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



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

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

#hashObject



245
246
247
# File 'lib/rbs/ast/members.rb', line 245

def hash
  self.class.hash ^ name.hash ^ type.hash ^ ivar_name.hash ^ kind.hash
end

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



225
226
227
228
229
230
231
232
233
# File 'lib/rbs/ast/members.rb', line 225

def initialize(name:, type:, ivar_name:, kind:, annotations:, location:, comment:)
  @name = name
  @type = type
  @ivar_name = ivar_name
  @annotations = annotations
  @location = location
  @comment = comment
  @kind = kind
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) ⇒ Object



249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/rbs/ast/members.rb', line 249

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)
  klass = _ = self.class
  klass.new(
    name: name,
    type: type,
    ivar_name: ivar_name,
    kind: kind,
    annotations: annotations,
    location: location,
    comment: comment
  )
end