Class: RBS::Definition::Method::TypeDef
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/rbs/definition.rb |
Class Method Summary
Instance Attribute Summary
- #annotations readonly
- #defined_in readonly
- #implemented_in readonly
- #member readonly
- #member_annotations readonly
- #overload? ⇒ Boolean readonly
- #overload_annotations readonly
- #type readonly
Instance Method Summary
Constructor Details
.new(type:, member:, defined_in:, implemented_in:, overload_annotations: []) ⇒ TypeDef
# File 'lib/rbs/definition.rb', line 35
def initialize(type:, member:, defined_in:, implemented_in:, overload_annotations: []) @type = type @member = member @defined_in = defined_in @implemented_in = implemented_in @member_annotations = member.annotations @overload_annotations = overload_annotations @annotations = member.annotations + overload_annotations end
Instance Attribute Details
#annotations (readonly)
[ GitHub ]# File 'lib/rbs/definition.rb', line 33
attr_reader :annotations
#defined_in (readonly)
[ GitHub ]# File 'lib/rbs/definition.rb', line 29
attr_reader :defined_in
#implemented_in (readonly)
[ GitHub ]# File 'lib/rbs/definition.rb', line 30
attr_reader :implemented_in
#member (readonly)
[ GitHub ]# File 'lib/rbs/definition.rb', line 28
attr_reader :member
#member_annotations (readonly)
[ GitHub ]# File 'lib/rbs/definition.rb', line 31
attr_reader :member_annotations
#overload? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/rbs/definition.rb', line 67
def overload? case mem = member when AST::Members::MethodDefinition mem.overloading? else false end end
#overload_annotations (readonly)
[ GitHub ]# File 'lib/rbs/definition.rb', line 32
attr_reader :overload_annotations
#type (readonly)
[ GitHub ]# File 'lib/rbs/definition.rb', line 27
attr_reader :type
Instance Method Details
#==(other) Also known as: #eql?
[ GitHub ]# File 'lib/rbs/definition.rb', line 45
def ==(other) other.is_a?(TypeDef) && other.type == type && other.member == member && other.defined_in == defined_in && other.implemented_in == implemented_in end
#comment
[ GitHub ]# File 'lib/rbs/definition.rb', line 59
def comment member.comment end
#eql?(other)
Alias for #==.
# File 'lib/rbs/definition.rb', line 53
alias eql? ==
#hash
[ GitHub ]# File 'lib/rbs/definition.rb', line 55
def hash self.class.hash ^ type.hash ^ member.hash ^ defined_in.hash ^ implemented_in.hash end
#update(type: self.type, member: self.member, defined_in: self.defined_in, implemented_in: self.implemented_in)
[ GitHub ]# File 'lib/rbs/definition.rb', line 63
def update(type: self.type, member: self.member, defined_in: self.defined_in, implemented_in: self.implemented_in) TypeDef.new(type: type, member: member, defined_in: defined_in, implemented_in: implemented_in, overload_annotations: overload_annotations) end