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.



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

def annotations
  @annotations
end

#commentObject (readonly)

Returns the value of attribute comment.



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

def comment
  @comment
end

#ivar_nameObject (readonly)

Returns the value of attribute ivar_name.



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

def ivar_name
  @ivar_name
end

#locationObject (readonly)

Returns the value of attribute location.



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

def location
  @location
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

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



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

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

#hashObject



247
248
249
# File 'lib/rbs/ast/members.rb', line 247

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

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



229
230
231
232
233
234
235
236
# File 'lib/rbs/ast/members.rb', line 229

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