class RBS::Types::Block
Attributes
location
[R]
loc?
required
[R]
bool
type
[R]
function
Public Class Methods
(type: function, required: boolish, ?location: loc?, ?self_type: t?) → void
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/types.rb, line 1354 def initialize(location: nil, type:, required:, self_type: nil) @location = location @type = type @required = required ? true : false @self_type = self_type end
Public Instance Methods
(untyped other) → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/types.rb, line 1361 def ==(other) other.is_a?(Block) && other.type == type && other.required == required && other.self_type == self_type end
() { (t) → t } → Block
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/types.rb, line 1386 def map_type(&block) Block.new( required: required, type: type.map_type(&block), self_type: self_type ? yield(self_type) : nil ) end
(Substitution) → Block
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/types.rb, line 1376 def sub(s) return self if s.empty? self.class.new( type: type.sub(s), required: required, self_type: self_type&.sub(s) ) end
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/lib/rbs/types.rb, line 1368 def to_json(state = nil) { type: type, required: required, self_type: self_type }.to_json(state) end