Module: RBS::AST::Members::Var

Included in:
ClassInstanceVariable, ClassVariable, InstanceVariable
Defined in:
lib/rbs/ast/members.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commentObject (readonly)

Returns the value of attribute comment.



123
124
125
# File 'lib/rbs/ast/members.rb', line 123

def comment
  @comment
end

#locationObject (readonly)

Returns the value of attribute location.



122
123
124
# File 'lib/rbs/ast/members.rb', line 122

def location
  @location
end

#nameObject (readonly)

Returns the value of attribute name.



120
121
122
# File 'lib/rbs/ast/members.rb', line 120

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



121
122
123
# File 'lib/rbs/ast/members.rb', line 121

def type
  @type
end

Instance Method Details

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



132
133
134
# File 'lib/rbs/ast/members.rb', line 132

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

#hashObject



138
139
140
# File 'lib/rbs/ast/members.rb', line 138

def hash
  name.hash ^ type.hash
end

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



125
126
127
128
129
130
# File 'lib/rbs/ast/members.rb', line 125

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