class RBS::Types::ClassSingleton
Attributes
location
[R]
loc?
Public Class Methods
Public Instance Methods
(untyped other) → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/types.rb, line 271 def ==(other) other.is_a?(ClassSingleton) && other.name == name && other.args == args end
Also aliased as: eql?, eql?
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/types.rb, line 277 def hash self.class.hash ^ name.hash ^ args.hash end
() { (t) → t } → ClassSingleton
() → Enumerator[t, ClassSingleton]
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/types.rb, line 309 def map_type(&block) if block ClassSingleton.new( name: name, args: args.map {|type| yield type }, location: location ) else enum_for :map_type end end
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/types.rb, line 301 def map_type_name(&block) ClassSingleton.new( name: yield(name, location, self), args: args.map {|type| type.map_type_name(&block) }, location: location ) end
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/types.rb, line 281 def sub(s) return self if s.empty? self.class.new(name: name, args: args.map {|ty| ty.sub(s) }, location: location) end
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/types.rb, line 289 def to_json(state = _ = nil) { class: :class_singleton, name: name, args: args, location: location }.to_json(state) end
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/types.rb, line 293 def to_s(level = 0) if args.empty? "singleton(#{name})" else "singleton(#{name})[#{args.join(", ")}]" end end