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

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#commentComment? (readonly)

Returns the value of attribute comment.

Returns:



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

def comment
  @comment
end

#locationloc? (readonly)

Returns the value of attribute location.

Returns:

  • (loc, nil)


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

def location
  @location
end

#nameSymbol (readonly)

Returns the value of attribute name.

Returns:

  • (Symbol)


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

def name
  @name
end

#typeTypes::t (readonly)

Returns the value of attribute type.

Returns:

  • (Types::t)


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

def type
  @type
end

Instance Method Details

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



134
135
136
# File 'lib/rbs/ast/members.rb', line 134

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

#hashObject



140
141
142
# File 'lib/rbs/ast/members.rb', line 140

def hash
  name.hash ^ type.hash
end

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

Returns a new instance of Var.

Parameters:

  • name: (Symbol)
  • type: (Types::t)
  • location: (loc, nil)
  • comment: (Comment, nil)

Returns:

  • (Var)

    a new instance of Var



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

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