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.



85
86
87
# File 'lib/rbs/ast/members.rb', line 85

def comment
  @comment
end

#locationObject (readonly)

Returns the value of attribute location.



84
85
86
# File 'lib/rbs/ast/members.rb', line 84

def location
  @location
end

#nameObject (readonly)

Returns the value of attribute name.



82
83
84
# File 'lib/rbs/ast/members.rb', line 82

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



83
84
85
# File 'lib/rbs/ast/members.rb', line 83

def type
  @type
end

Instance Method Details

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



94
95
96
# File 'lib/rbs/ast/members.rb', line 94

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

#hashObject



100
101
102
# File 'lib/rbs/ast/members.rb', line 100

def hash
  name.hash ^ type.hash
end

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



87
88
89
90
91
92
# File 'lib/rbs/ast/members.rb', line 87

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