Class: RBS::Types::ClassSingleton
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Instance Chain:
self,
Application
|
|
| Inherits: | Object |
| Defined in: | lib/rbs/types.rb |
Class Method Summary
Instance Attribute Summary
- #location readonly
Application - Included
Instance Method Summary
- #==(other) (also: #eql?)
- #eql?(other)
- #hash
- #map_type(&block)
- #map_type_name(&block)
- #sub(s)
- #to_json(state = _ = nil)
- #to_s(level = 0)
Application - Included
| #==, #each_type, | |
| #eql? |
|
| #free_variables, #hash, #to_s | |
Constructor Details
.new(name:, location:, args: []) ⇒ ClassSingleton
# File 'lib/rbs/types.rb', line 265
def initialize(name:, location:, args: []) @name = name @location = location @args = args end
Instance Attribute Details
#location (readonly)
[ GitHub ]# File 'lib/rbs/types.rb', line 261
attr_reader :location
Instance Method Details
#==(other) Also known as: #eql?
[ GitHub ]# File 'lib/rbs/types.rb', line 271
def ==(other) other.is_a?(ClassSingleton) && other.name == name && other.args == args end
#eql?(other)
[ GitHub ]# File 'lib/rbs/types.rb', line 275
alias eql? ==
#hash
[ GitHub ]# File 'lib/rbs/types.rb', line 277
def hash self.class.hash ^ name.hash ^ args.hash end
#map_type(&block)
[ GitHub ]#map_type_name(&block)
[ GitHub ]#sub(s)
[ GitHub ]#to_json(state = _ = nil)
[ GitHub ]# File 'lib/rbs/types.rb', line 289
def to_json(state = _ = nil) { class: :class_singleton, name: name, args: args, location: location }.to_json(state) end
#to_s(level = 0)
[ GitHub ]# File 'lib/rbs/types.rb', line 293
def to_s(level = 0) if args.empty? "singleton(#{name})" else "singleton(#{name})[#{args.join(", ")}]" end end